Add temporal FOREIGN KEY contraints
authorPeter Eisentraut <[email protected]>
Sun, 24 Mar 2024 06:37:13 +0000 (07:37 +0100)
committerPeter Eisentraut <[email protected]>
Sun, 24 Mar 2024 06:37:13 +0000 (07:37 +0100)
commit34768ee361656841a122f1c8d52a2ad753612feb
tree7a4fef14e45e477f18d545231d65942b27a01bb4
parentb1fe8efdf17eb4877f7c4c31c85111ec740ad872
Add temporal FOREIGN KEY contraints

Add PERIOD clause to foreign key constraint definitions.  This is
supported for range and multirange types.  Temporal foreign keys check
for range containment instead of equality.

This feature matches the behavior of the SQL standard temporal foreign
keys, but it works on PostgreSQL's native ranges instead of SQL's
"periods", which don't exist in PostgreSQL (yet).

Reference actions ON {UPDATE,DELETE} {CASCADE,SET NULL,SET DEFAULT}
are not supported yet.

Author: Paul A. Jungwirth <[email protected]>
Reviewed-by: Peter Eisentraut <[email protected]>
Reviewed-by: jian he <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com
16 files changed:
contrib/btree_gist/expected/without_overlaps.out
contrib/btree_gist/sql/without_overlaps.sql
doc/src/sgml/catalogs.sgml
doc/src/sgml/ref/create_table.sgml
src/backend/catalog/pg_constraint.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/parser/gram.y
src/backend/utils/adt/ri_triggers.c
src/backend/utils/adt/ruleutils.c
src/include/catalog/pg_constraint.h
src/include/commands/defrem.h
src/include/nodes/parsenodes.h
src/include/parser/kwlist.h
src/test/regress/expected/without_overlaps.out
src/test/regress/sql/without_overlaps.sql