Skip to content

Commit

Permalink
test: Adjust with updated line numbers
Browse files Browse the repository at this point in the history
As more debug print statements are added.
  • Loading branch information
jhf committed Jun 9, 2024
1 parent 17e73d4 commit bc9cdb1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions expected/06_unique_foreign.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions expected/13_issues.out
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions expected/24_delete_pk_test.out
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ 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;
-- You can't delete a finite pk range that is exactly covered
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;
-- You can't delete a finite pk range that is more than covered
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;
Expand All @@ -51,23 +51,23 @@ 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;
-- You can't delete an infinite pk range that is exactly covered
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;
-- You can't delete an infinite pk range that is more than covered
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;
Expand Down
2 changes: 1 addition & 1 deletion expected/25_update_pk_test.out
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions expected/28_with_exclusion_constraints.out
Original file line number Diff line number Diff line change
Expand Up @@ -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
--
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
--
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion expected/41_with_schema_test.out
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit bc9cdb1

Please sign in to comment.