diff --git a/expected/06_unique_foreign.out b/expected/06_unique_foreign.out index 072600a..7d26dfb 100644 --- a/expected/06_unique_foreign.out +++ b/expected/06_unique_foreign.out @@ -95,14 +95,14 @@ PL/pgSQL function sql_saga.fk_update_check() line 19 at PERFORM UPDATE fk SET e = 6 WHERE id = 1; -- success UPDATE uk SET s = 2 WHERE (id, s, e) = (100, 1, 3); -- fail ERROR: update or delete on table "uk" violates foreign key constraint "fk_uk_id_q" on table "fk" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM UPDATE uk SET s = 0 WHERE (id, s, e) = (100, 1, 3); -- success -- DELETE DELETE FROM uk WHERE (id, s, e) = (100, 3, 4); -- fail ERROR: update or delete on table "uk" violates foreign key constraint "fk_uk_id_q" on table "fk" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 176 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 178 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM uk WHERE (id, s, e) = (200, 3, 5); -- success diff --git a/expected/13_issues.out b/expected/13_issues.out index c3cf150..49f6c36 100644 --- a/expected/13_issues.out +++ b/expected/13_issues.out @@ -64,7 +64,7 @@ TABLE fk; --expected: fail DELETE FROM uk WHERE (id, s, e) = (1, 1, 3); ERROR: update or delete on table "uk" violates foreign key constraint "fk_uk_id_q" on table "fk" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM TABLE uk; @@ -84,7 +84,7 @@ TABLE fk; --expected: fail DELETE FROM uk WHERE (id, s, e) = (1, 3, 5); ERROR: update or delete on table "uk" violates foreign key constraint "fk_uk_id_q" on table "fk" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM INSERT INTO uk(id, s, e) VALUES (2, 1, 5); @@ -108,7 +108,7 @@ TABLE fk; --expected: fail UPDATE uk SET e = 3 WHERE (id, s, e) = (2, 1, 5); ERROR: update or delete on table "uk" violates foreign key constraint "fk_uk_id_q" on table "fk" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM TABLE uk; diff --git a/expected/24_delete_pk_test.out b/expected/24_delete_pk_test.out index fb07fbf..761e3e0 100644 --- a/expected/24_delete_pk_test.out +++ b/expected/24_delete_pk_test.out @@ -22,7 +22,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 1, '2016-01-01'::TIMESTAMPTZ, '2016-06-01'::TIMESTAMPTZ); DELETE FROM houses WHERE id = 1 and tstzrange(valid_from, valid_to) @> '2016-06-01'::timestamptz; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM rooms; @@ -30,7 +30,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 1, '2016-01-01'::TIMESTAMPTZ, '2017-01-01'::TIMESTAMPTZ); DELETE FROM houses WHERE id = 1 and tstzrange(valid_from, valid_to) @> '2016-06-01'::timestamptz; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM rooms; @@ -38,7 +38,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 1, '2015-06-01'::TIMESTAMPTZ, '2017-01-01'::TIMESTAMPTZ); DELETE FROM houses WHERE id = 1 and tstzrange(valid_from, valid_to) @> '2016-06-01'::timestamptz; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM rooms; @@ -51,7 +51,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 3, '2016-01-01'::TIMESTAMPTZ, '2017-01-01'::TIMESTAMPTZ); DELETE FROM houses WHERE id = 3 and tstzrange(valid_from, valid_to) @> '2016-01-01'::timestamptz; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM rooms; @@ -59,7 +59,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 3, '2015-01-01'::TIMESTAMPTZ, 'infinity'); DELETE FROM houses WHERE id = 3 and tstzrange(valid_from, valid_to) @> '2016-01-01'::timestamptz; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM rooms; @@ -67,7 +67,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 3, '2014-06-01'::TIMESTAMPTZ, 'infinity'); DELETE FROM houses WHERE id = 3 and tstzrange(valid_from, valid_to) @> '2016-01-01'::timestamptz; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM DELETE FROM rooms; diff --git a/expected/25_update_pk_test.out b/expected/25_update_pk_test.out index b603a84..6c6a401 100644 --- a/expected/25_update_pk_test.out +++ b/expected/25_update_pk_test.out @@ -27,7 +27,7 @@ DELETE FROM rooms; INSERT INTO rooms VALUES (1, 1, '2016-01-01', '2016-06-01'); UPDATE houses SET id = 4 WHERE id = 1; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 126 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 127 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM DELETE FROM rooms; diff --git a/expected/28_with_exclusion_constraints.out b/expected/28_with_exclusion_constraints.out index c1f7fdf..a976c86 100644 --- a/expected/28_with_exclusion_constraints.out +++ b/expected/28_with_exclusion_constraints.out @@ -61,7 +61,7 @@ SET (valid_from, valid_to) = ('2016-06-01', '2017-01-01') WHERE id = 1 AND valid_from = '2016-01-01' ; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 176 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 178 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM -- @@ -120,7 +120,7 @@ SET (valid_from, valid_to) = ('2016-06-01', '2017-01-01') WHERE id = 1 AND valid_from = '2016-01-01' ; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 176 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 178 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM UPDATE houses @@ -203,7 +203,7 @@ SET (valid_from, valid_to) = ('2015-01-01', '2015-06-01') WHERE id = 1 AND valid_from = '2015-01-01' ; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 176 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 178 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM UPDATE houses @@ -268,7 +268,7 @@ SET (valid_from, valid_to) = ('2015-01-01', '2015-06-01') WHERE id = 1 AND valid_from = '2015-01-01' ; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 176 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 178 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM -- @@ -328,7 +328,7 @@ SET valid_from = '2019-01-01', valid_to = '2020-01-01' WHERE id = 1 AND valid_from = '2016-01-01'; COMMIT; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM -- 3.2. Large shift to a later time (all the way past the later range), later first: @@ -345,7 +345,7 @@ SET valid_from = '2018-01-01', valid_to = '2019-01-01' WHERE id = 1 AND valid_from = '2015-01-01'; COMMIT; ERROR: update or delete on table "houses" violates foreign key constraint "rooms_house_id_valid" on table "rooms" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 149 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 151 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, true)" PL/pgSQL function sql_saga.uk_update_check() line 23 at PERFORM -- 4. Large shift to an earlier time (all the way past the earlier range) diff --git a/expected/41_with_schema_test.out b/expected/41_with_schema_test.out index 8bdc513..e7f8f33 100644 --- a/expected/41_with_schema_test.out +++ b/expected/41_with_schema_test.out @@ -166,7 +166,7 @@ INSERT INTO hidden.staff (id, valid_from, valid_to, employee_id, salary) VALUES -- Fail DELETE FROM exposed.employees WHERE id = 101; ERROR: update or delete on table "exposed.employees" violates foreign key constraint "staff_employee_id_valid" on table "hidden.staff" -CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 126 at RAISE +CONTEXT: PL/pgSQL function sql_saga.validate_foreign_key_old_row(name,jsonb,boolean) line 127 at RAISE SQL statement "SELECT sql_saga.validate_foreign_key_old_row(TG_ARGV[0], jold, false)" PL/pgSQL function sql_saga.uk_delete_check() line 22 at PERFORM