mirror of https://github.com/citusdata/citus.git
Remove test cases and SQL files related to issue #7887 and update multi_schedule test
parent
57bce8fcce
commit
fb01c341d0
|
@ -560,5 +560,116 @@ SELECT * FROM test;
|
||||||
1 | 2 | 2
|
1 | 2 | 2
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
|
-- Test for issue #7887 Fix insert select planner to exclude identity columns from target list on partial inserts
|
||||||
|
-- https://github.com/citusdata/citus/pull/7911
|
||||||
|
CREATE TABLE local1 (
|
||||||
|
id text not null primary key
|
||||||
|
);
|
||||||
|
CREATE TABLE reference1 (
|
||||||
|
id int not null primary key,
|
||||||
|
reference_col1 text not null
|
||||||
|
);
|
||||||
|
SELECT create_reference_table('reference1');
|
||||||
|
create_reference_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
CREATE TABLE local2 (
|
||||||
|
id int not null generated always as identity,
|
||||||
|
local1fk text not null,
|
||||||
|
reference1fk int not null,
|
||||||
|
constraint loc1fk foreign key (local1fk) references local1(id),
|
||||||
|
constraint reference1fk foreign key (reference1fk) references reference1(id),
|
||||||
|
constraint testlocpk primary key (id)
|
||||||
|
);
|
||||||
|
INSERT INTO local1(id) VALUES ('aaaaa'), ('bbbbb'), ('ccccc');
|
||||||
|
INSERT INTO reference1(id, reference_col1) VALUES (1, 'test'), (2, 'test2'), (3, 'test3');
|
||||||
|
--
|
||||||
|
-- Partial insert: omit the identity column
|
||||||
|
-- This triggers the known bug in older code paths if not fixed.
|
||||||
|
--
|
||||||
|
INSERT INTO local2(local1fk, reference1fk)
|
||||||
|
SELECT id, 1
|
||||||
|
FROM local1;
|
||||||
|
-- Check inserted rows in local2
|
||||||
|
SELECT * FROM local2;
|
||||||
|
id | local1fk | reference1fk
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1 | aaaaa | 1
|
||||||
|
2 | bbbbb | 1
|
||||||
|
3 | ccccc | 1
|
||||||
|
(3 rows)
|
||||||
|
|
||||||
|
-- We do a "INSERT INTO local2(id, local1fk, reference1fk) SELECT 9999, id, 2" which
|
||||||
|
-- should fail under normal PG rules if no OVERRIDING clause is used.
|
||||||
|
INSERT INTO local2(id, local1fk, reference1fk)
|
||||||
|
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
||||||
|
ERROR: cannot insert a non-DEFAULT value into column "id"
|
||||||
|
DETAIL: Column "id" is an identity column defined as GENERATED ALWAYS.
|
||||||
|
HINT: Use OVERRIDING SYSTEM VALUE to override.
|
||||||
|
-- Using OVERRIDING SYSTEM VALUE to override ALWAYS identity
|
||||||
|
INSERT INTO local2(id, local1fk, reference1fk)
|
||||||
|
OVERRIDING SYSTEM VALUE
|
||||||
|
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
||||||
|
-- Create a second table with BY DEFAULT identity to test different identity mode
|
||||||
|
CREATE TABLE local2_bydefault (
|
||||||
|
id int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
local1fk text NOT NULL,
|
||||||
|
reference1fk int NOT NULL,
|
||||||
|
CONSTRAINT loc1fk_bd FOREIGN KEY (local1fk) REFERENCES local1(id),
|
||||||
|
CONSTRAINT reference1fk_bd FOREIGN KEY (reference1fk) REFERENCES reference1(id),
|
||||||
|
CONSTRAINT testlocpk_bd PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
INSERT INTO local1(id) VALUES ('xxxxx'), ('yyyyy'), ('ddddd'), ('zzzzz');
|
||||||
|
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
||||||
|
SELECT 'xxxxx', 1;
|
||||||
|
-- Show inserted row in local2_bydefault
|
||||||
|
SELECT * FROM local2_bydefault;
|
||||||
|
id | local1fk | reference1fk
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1 | xxxxx | 1
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Overriding a BY DEFAULT identity with user value
|
||||||
|
-- (which is allowed even without OVERRIDING clause).
|
||||||
|
--
|
||||||
|
-- Provide explicit id for BY DEFAULT identity => no special OVERRIDING needed
|
||||||
|
INSERT INTO local2_bydefault(id, local1fk, reference1fk)
|
||||||
|
VALUES (5000, 'yyyyy', 2);
|
||||||
|
-- Show rows (we expect id=5000 and one with auto-generated ID)
|
||||||
|
SELECT * FROM local2_bydefault ORDER BY id;
|
||||||
|
id | local1fk | reference1fk
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
1 | xxxxx | 1
|
||||||
|
5000 | yyyyy | 2
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- Insert referencing reference1fk=3 => partial insert on both tables
|
||||||
|
INSERT INTO local2(local1fk, reference1fk)
|
||||||
|
VALUES ('ddddd', 3);
|
||||||
|
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
||||||
|
SELECT 'zzzzz', 3;
|
||||||
|
-- Show final state of local2 and local2_bydefault
|
||||||
|
SELECT 'local2' as table_name, * FROM local2
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'local2_bydefault', * FROM local2_bydefault
|
||||||
|
ORDER BY table_name, id;
|
||||||
|
table_name | id | local1fk | reference1fk
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
local2 | 1 | aaaaa | 1
|
||||||
|
local2 | 2 | bbbbb | 1
|
||||||
|
local2 | 3 | ccccc | 1
|
||||||
|
local2 | 4 | ddddd | 3
|
||||||
|
local2 | 9999 | aaaaa | 2
|
||||||
|
local2_bydefault | 1 | xxxxx | 1
|
||||||
|
local2_bydefault | 2 | zzzzz | 3
|
||||||
|
local2_bydefault | 5000 | yyyyy | 2
|
||||||
|
(8 rows)
|
||||||
|
|
||||||
|
-- End of test for issue #7887
|
||||||
|
-- Cleanup
|
||||||
|
SET client_min_messages TO WARNING;
|
||||||
DROP SCHEMA generated_identities CASCADE;
|
DROP SCHEMA generated_identities CASCADE;
|
||||||
DROP USER identity_test_user;
|
DROP USER identity_test_user;
|
||||||
|
|
|
@ -1,111 +0,0 @@
|
||||||
CREATE SCHEMA issue_7887;
|
|
||||||
SET search_path to 'issue_7887';
|
|
||||||
CREATE TABLE local1 (
|
|
||||||
id text not null primary key
|
|
||||||
);
|
|
||||||
CREATE TABLE reference1 (
|
|
||||||
id int not null primary key,
|
|
||||||
reference_col1 text not null
|
|
||||||
);
|
|
||||||
SELECT create_reference_table('reference1');
|
|
||||||
create_reference_table
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
CREATE TABLE local2 (
|
|
||||||
id int not null generated always as identity,
|
|
||||||
local1fk text not null,
|
|
||||||
reference1fk int not null,
|
|
||||||
constraint loc1fk foreign key (local1fk) references local1(id),
|
|
||||||
constraint reference1fk foreign key (reference1fk) references reference1(id),
|
|
||||||
constraint testlocpk primary key (id)
|
|
||||||
);
|
|
||||||
INSERT INTO local1(id) VALUES ('aaaaa'), ('bbbbb'), ('ccccc');
|
|
||||||
INSERT INTO reference1(id, reference_col1) VALUES (1, 'test'), (2, 'test2'), (3, 'test3');
|
|
||||||
--
|
|
||||||
-- Partial insert: omit the identity column
|
|
||||||
-- This triggers the known bug in older code paths if not fixed.
|
|
||||||
--
|
|
||||||
INSERT INTO local2(local1fk, reference1fk)
|
|
||||||
SELECT id, 1
|
|
||||||
FROM local1;
|
|
||||||
-- Check inserted rows in local2
|
|
||||||
SELECT * FROM local2;
|
|
||||||
id | local1fk | reference1fk
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1 | aaaaa | 1
|
|
||||||
2 | bbbbb | 1
|
|
||||||
3 | ccccc | 1
|
|
||||||
(3 rows)
|
|
||||||
|
|
||||||
-- We do a "INSERT INTO local2(id, local1fk, reference1fk) SELECT 9999, id, 2" which
|
|
||||||
-- should fail under normal PG rules if no OVERRIDING clause is used.
|
|
||||||
INSERT INTO local2(id, local1fk, reference1fk)
|
|
||||||
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
|
||||||
ERROR: cannot insert a non-DEFAULT value into column "id"
|
|
||||||
DETAIL: Column "id" is an identity column defined as GENERATED ALWAYS.
|
|
||||||
HINT: Use OVERRIDING SYSTEM VALUE to override.
|
|
||||||
-- Using OVERRIDING SYSTEM VALUE to override ALWAYS identity
|
|
||||||
INSERT INTO local2(id, local1fk, reference1fk)
|
|
||||||
OVERRIDING SYSTEM VALUE
|
|
||||||
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
|
||||||
-- Create a second table with BY DEFAULT identity to test different identity mode
|
|
||||||
CREATE TABLE local2_bydefault (
|
|
||||||
id int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
|
||||||
local1fk text NOT NULL,
|
|
||||||
reference1fk int NOT NULL,
|
|
||||||
CONSTRAINT loc1fk_bd FOREIGN KEY (local1fk) REFERENCES local1(id),
|
|
||||||
CONSTRAINT reference1fk_bd FOREIGN KEY (reference1fk) REFERENCES reference1(id),
|
|
||||||
CONSTRAINT testlocpk_bd PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
INSERT INTO local1(id) VALUES ('xxxxx'), ('yyyyy'), ('ddddd'), ('zzzzz');
|
|
||||||
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
|
||||||
SELECT 'xxxxx', 1;
|
|
||||||
-- Show inserted row in local2_bydefault
|
|
||||||
SELECT * FROM local2_bydefault;
|
|
||||||
id | local1fk | reference1fk
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1 | xxxxx | 1
|
|
||||||
(1 row)
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Overriding a BY DEFAULT identity with user value
|
|
||||||
-- (which is allowed even without OVERRIDING clause).
|
|
||||||
--
|
|
||||||
-- Provide explicit id for BY DEFAULT identity => no special OVERRIDING needed
|
|
||||||
INSERT INTO local2_bydefault(id, local1fk, reference1fk)
|
|
||||||
VALUES (5000, 'yyyyy', 2);
|
|
||||||
-- Show rows (we expect id=5000 and one with auto-generated ID)
|
|
||||||
SELECT * FROM local2_bydefault ORDER BY id;
|
|
||||||
id | local1fk | reference1fk
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
1 | xxxxx | 1
|
|
||||||
5000 | yyyyy | 2
|
|
||||||
(2 rows)
|
|
||||||
|
|
||||||
-- Insert referencing reference1fk=3 => partial insert on both tables
|
|
||||||
INSERT INTO local2(local1fk, reference1fk)
|
|
||||||
VALUES ('ddddd', 3);
|
|
||||||
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
|
||||||
SELECT 'zzzzz', 3;
|
|
||||||
-- Show final state of local2 and local2_bydefault
|
|
||||||
SELECT 'local2' as table_name, * FROM local2
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'local2_bydefault', * FROM local2_bydefault
|
|
||||||
ORDER BY table_name, id;
|
|
||||||
table_name | id | local1fk | reference1fk
|
|
||||||
---------------------------------------------------------------------
|
|
||||||
local2 | 1 | aaaaa | 1
|
|
||||||
local2 | 2 | bbbbb | 1
|
|
||||||
local2 | 3 | ccccc | 1
|
|
||||||
local2 | 4 | ddddd | 3
|
|
||||||
local2 | 9999 | aaaaa | 2
|
|
||||||
local2_bydefault | 1 | xxxxx | 1
|
|
||||||
local2_bydefault | 2 | zzzzz | 3
|
|
||||||
local2_bydefault | 5000 | yyyyy | 2
|
|
||||||
(8 rows)
|
|
||||||
|
|
||||||
-- Cleanup
|
|
||||||
SET client_min_messages TO WARNING;
|
|
||||||
DROP SCHEMA issue_7887 CASCADE;
|
|
|
@ -103,8 +103,7 @@ test: multi_dropped_column_aliases foreign_key_restriction_enforcement
|
||||||
test: binary_protocol
|
test: binary_protocol
|
||||||
test: alter_table_set_access_method
|
test: alter_table_set_access_method
|
||||||
test: alter_distributed_table
|
test: alter_distributed_table
|
||||||
test: issue_5248 issue_5099 issue_5763 issue_6758 issue_7477 issue_7891 issue_7887
|
test: issue_5248 issue_5099 issue_5763 issue_6543 issue_6758 issue_7477 issue_7891
|
||||||
test: issue_6543
|
|
||||||
test: object_propagation_debug
|
test: object_propagation_debug
|
||||||
test: undistribute_table
|
test: undistribute_table
|
||||||
test: run_command_on_all_nodes
|
test: run_command_on_all_nodes
|
||||||
|
|
|
@ -279,5 +279,99 @@ INSERT INTO test VALUES (1,2);
|
||||||
INSERT INTO test SELECT x, y FROM test WHERE x = 1;
|
INSERT INTO test SELECT x, y FROM test WHERE x = 1;
|
||||||
SELECT * FROM test;
|
SELECT * FROM test;
|
||||||
|
|
||||||
|
|
||||||
|
-- Test for issue #7887 Fix insert select planner to exclude identity columns from target list on partial inserts
|
||||||
|
-- https://github.com/citusdata/citus/pull/7911
|
||||||
|
CREATE TABLE local1 (
|
||||||
|
id text not null primary key
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE reference1 (
|
||||||
|
id int not null primary key,
|
||||||
|
reference_col1 text not null
|
||||||
|
);
|
||||||
|
SELECT create_reference_table('reference1');
|
||||||
|
|
||||||
|
CREATE TABLE local2 (
|
||||||
|
id int not null generated always as identity,
|
||||||
|
local1fk text not null,
|
||||||
|
reference1fk int not null,
|
||||||
|
constraint loc1fk foreign key (local1fk) references local1(id),
|
||||||
|
constraint reference1fk foreign key (reference1fk) references reference1(id),
|
||||||
|
constraint testlocpk primary key (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO local1(id) VALUES ('aaaaa'), ('bbbbb'), ('ccccc');
|
||||||
|
INSERT INTO reference1(id, reference_col1) VALUES (1, 'test'), (2, 'test2'), (3, 'test3');
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Partial insert: omit the identity column
|
||||||
|
-- This triggers the known bug in older code paths if not fixed.
|
||||||
|
--
|
||||||
|
INSERT INTO local2(local1fk, reference1fk)
|
||||||
|
SELECT id, 1
|
||||||
|
FROM local1;
|
||||||
|
|
||||||
|
-- Check inserted rows in local2
|
||||||
|
SELECT * FROM local2;
|
||||||
|
|
||||||
|
|
||||||
|
-- We do a "INSERT INTO local2(id, local1fk, reference1fk) SELECT 9999, id, 2" which
|
||||||
|
-- should fail under normal PG rules if no OVERRIDING clause is used.
|
||||||
|
|
||||||
|
INSERT INTO local2(id, local1fk, reference1fk)
|
||||||
|
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
||||||
|
|
||||||
|
-- Using OVERRIDING SYSTEM VALUE to override ALWAYS identity
|
||||||
|
INSERT INTO local2(id, local1fk, reference1fk)
|
||||||
|
OVERRIDING SYSTEM VALUE
|
||||||
|
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
||||||
|
|
||||||
|
-- Create a second table with BY DEFAULT identity to test different identity mode
|
||||||
|
CREATE TABLE local2_bydefault (
|
||||||
|
id int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
||||||
|
local1fk text NOT NULL,
|
||||||
|
reference1fk int NOT NULL,
|
||||||
|
CONSTRAINT loc1fk_bd FOREIGN KEY (local1fk) REFERENCES local1(id),
|
||||||
|
CONSTRAINT reference1fk_bd FOREIGN KEY (reference1fk) REFERENCES reference1(id),
|
||||||
|
CONSTRAINT testlocpk_bd PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO local1(id) VALUES ('xxxxx'), ('yyyyy'), ('ddddd'), ('zzzzz');
|
||||||
|
|
||||||
|
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
||||||
|
SELECT 'xxxxx', 1;
|
||||||
|
|
||||||
|
-- Show inserted row in local2_bydefault
|
||||||
|
SELECT * FROM local2_bydefault;
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Overriding a BY DEFAULT identity with user value
|
||||||
|
-- (which is allowed even without OVERRIDING clause).
|
||||||
|
--
|
||||||
|
-- Provide explicit id for BY DEFAULT identity => no special OVERRIDING needed
|
||||||
|
INSERT INTO local2_bydefault(id, local1fk, reference1fk)
|
||||||
|
VALUES (5000, 'yyyyy', 2);
|
||||||
|
|
||||||
|
-- Show rows (we expect id=5000 and one with auto-generated ID)
|
||||||
|
SELECT * FROM local2_bydefault ORDER BY id;
|
||||||
|
|
||||||
|
-- Insert referencing reference1fk=3 => partial insert on both tables
|
||||||
|
INSERT INTO local2(local1fk, reference1fk)
|
||||||
|
VALUES ('ddddd', 3);
|
||||||
|
|
||||||
|
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
||||||
|
SELECT 'zzzzz', 3;
|
||||||
|
|
||||||
|
-- Show final state of local2 and local2_bydefault
|
||||||
|
SELECT 'local2' as table_name, * FROM local2
|
||||||
|
UNION ALL
|
||||||
|
SELECT 'local2_bydefault', * FROM local2_bydefault
|
||||||
|
ORDER BY table_name, id;
|
||||||
|
|
||||||
|
-- End of test for issue #7887
|
||||||
|
|
||||||
|
-- Cleanup
|
||||||
|
SET client_min_messages TO WARNING;
|
||||||
DROP SCHEMA generated_identities CASCADE;
|
DROP SCHEMA generated_identities CASCADE;
|
||||||
DROP USER identity_test_user;
|
DROP USER identity_test_user;
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
CREATE SCHEMA issue_7887;
|
|
||||||
SET search_path to 'issue_7887';
|
|
||||||
|
|
||||||
CREATE TABLE local1 (
|
|
||||||
id text not null primary key
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE reference1 (
|
|
||||||
id int not null primary key,
|
|
||||||
reference_col1 text not null
|
|
||||||
);
|
|
||||||
SELECT create_reference_table('reference1');
|
|
||||||
|
|
||||||
CREATE TABLE local2 (
|
|
||||||
id int not null generated always as identity,
|
|
||||||
local1fk text not null,
|
|
||||||
reference1fk int not null,
|
|
||||||
constraint loc1fk foreign key (local1fk) references local1(id),
|
|
||||||
constraint reference1fk foreign key (reference1fk) references reference1(id),
|
|
||||||
constraint testlocpk primary key (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO local1(id) VALUES ('aaaaa'), ('bbbbb'), ('ccccc');
|
|
||||||
INSERT INTO reference1(id, reference_col1) VALUES (1, 'test'), (2, 'test2'), (3, 'test3');
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Partial insert: omit the identity column
|
|
||||||
-- This triggers the known bug in older code paths if not fixed.
|
|
||||||
--
|
|
||||||
INSERT INTO local2(local1fk, reference1fk)
|
|
||||||
SELECT id, 1
|
|
||||||
FROM local1;
|
|
||||||
|
|
||||||
-- Check inserted rows in local2
|
|
||||||
SELECT * FROM local2;
|
|
||||||
|
|
||||||
|
|
||||||
-- We do a "INSERT INTO local2(id, local1fk, reference1fk) SELECT 9999, id, 2" which
|
|
||||||
-- should fail under normal PG rules if no OVERRIDING clause is used.
|
|
||||||
|
|
||||||
INSERT INTO local2(id, local1fk, reference1fk)
|
|
||||||
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
|
||||||
|
|
||||||
-- Using OVERRIDING SYSTEM VALUE to override ALWAYS identity
|
|
||||||
INSERT INTO local2(id, local1fk, reference1fk)
|
|
||||||
OVERRIDING SYSTEM VALUE
|
|
||||||
SELECT 9999, id, 2 FROM local1 LIMIT 1;
|
|
||||||
|
|
||||||
-- Create a second table with BY DEFAULT identity to test different identity mode
|
|
||||||
CREATE TABLE local2_bydefault (
|
|
||||||
id int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
|
|
||||||
local1fk text NOT NULL,
|
|
||||||
reference1fk int NOT NULL,
|
|
||||||
CONSTRAINT loc1fk_bd FOREIGN KEY (local1fk) REFERENCES local1(id),
|
|
||||||
CONSTRAINT reference1fk_bd FOREIGN KEY (reference1fk) REFERENCES reference1(id),
|
|
||||||
CONSTRAINT testlocpk_bd PRIMARY KEY (id)
|
|
||||||
);
|
|
||||||
|
|
||||||
INSERT INTO local1(id) VALUES ('xxxxx'), ('yyyyy'), ('ddddd'), ('zzzzz');
|
|
||||||
|
|
||||||
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
|
||||||
SELECT 'xxxxx', 1;
|
|
||||||
|
|
||||||
-- Show inserted row in local2_bydefault
|
|
||||||
SELECT * FROM local2_bydefault;
|
|
||||||
|
|
||||||
--
|
|
||||||
-- Overriding a BY DEFAULT identity with user value
|
|
||||||
-- (which is allowed even without OVERRIDING clause).
|
|
||||||
--
|
|
||||||
-- Provide explicit id for BY DEFAULT identity => no special OVERRIDING needed
|
|
||||||
INSERT INTO local2_bydefault(id, local1fk, reference1fk)
|
|
||||||
VALUES (5000, 'yyyyy', 2);
|
|
||||||
|
|
||||||
-- Show rows (we expect id=5000 and one with auto-generated ID)
|
|
||||||
SELECT * FROM local2_bydefault ORDER BY id;
|
|
||||||
|
|
||||||
-- Insert referencing reference1fk=3 => partial insert on both tables
|
|
||||||
INSERT INTO local2(local1fk, reference1fk)
|
|
||||||
VALUES ('ddddd', 3);
|
|
||||||
|
|
||||||
INSERT INTO local2_bydefault(local1fk, reference1fk)
|
|
||||||
SELECT 'zzzzz', 3;
|
|
||||||
|
|
||||||
-- Show final state of local2 and local2_bydefault
|
|
||||||
SELECT 'local2' as table_name, * FROM local2
|
|
||||||
UNION ALL
|
|
||||||
SELECT 'local2_bydefault', * FROM local2_bydefault
|
|
||||||
ORDER BY table_name, id;
|
|
||||||
|
|
||||||
-- Cleanup
|
|
||||||
SET client_min_messages TO WARNING;
|
|
||||||
DROP SCHEMA issue_7887 CASCADE;
|
|
Loading…
Reference in New Issue