You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
According to the SQL standard, if the referential action RESTRICT istriggered, it has its own error code. We previously didn't use that,we just used the error code for foreign key violation. But RESTRICTis not necessarily an actual foreign key violation. The foreign keymight still be satisfied in theory afterwards, but the RESTRICTsetting prevents the action even then. So it's a separate kind oferror condition.Discussion:https://www.postgresql.org/message-id/ea5b2777-266a-46fa-852f-6fca6ec480ad@eisentraut.org
DELETE FROM temporal_partitioned_rng WHERE id = '[5,6)' AND valid_at = daterange('2018-02-01', '2018-03-01');
2433
2433
-- should fail:
2434
2434
DELETE FROM temporal_partitioned_rng WHERE id = '[5,6)' AND valid_at = daterange('2018-01-01', '2018-02-01');
2435
-
ERROR: update or delete on table "tp1" violates foreign key constraint "temporal_partitioned_fk_rng2rng_parent_id_valid_at_fkey" on table "temporal_partitioned_fk_rng2rng"
2436
-
DETAIL: Key (id, valid_at)=([5,6), [2018-01-01,2018-02-01)) isstillreferenced from table "temporal_partitioned_fk_rng2rng".
2435
+
ERROR: update or delete on table "tp1" violatesRESTRICT setting offoreign key constraint "temporal_partitioned_fk_rng2rng_parent_id_valid_at_fkey" on table "temporal_partitioned_fk_rng2rng"
2436
+
DETAIL: Key (id, valid_at)=([5,6), [2018-01-01,2018-02-01)) is referenced from table "temporal_partitioned_fk_rng2rng".
DELETE FROM temporal_partitioned_mltrng WHERE id = '[5,6)' AND valid_at = datemultirange(daterange('2018-02-01', '2018-03-01'));
2589
2589
-- should fail:
2590
2590
DELETE FROM temporal_partitioned_mltrng WHERE id = '[5,6)' AND valid_at = datemultirange(daterange('2018-01-01', '2018-02-01'));
2591
-
ERROR: update or delete on table "tp1" violates foreign key constraint "temporal_partitioned_fk_mltrng2mltrng_parent_id_valid_at_fkey1" on table "temporal_partitioned_fk_mltrng2mltrng"
2592
-
DETAIL: Key (id, valid_at)=([5,6), {[2018-01-01,2018-02-01)}) isstillreferenced from table "temporal_partitioned_fk_mltrng2mltrng".
2591
+
ERROR: update or delete on table "tp1" violatesRESTRICT setting offoreign key constraint "temporal_partitioned_fk_mltrng2mltrng_parent_id_valid_at_fkey1" on table "temporal_partitioned_fk_mltrng2mltrng"
2592
+
DETAIL: Key (id, valid_at)=([5,6), {[2018-01-01,2018-02-01)}) is referenced from table "temporal_partitioned_fk_mltrng2mltrng".