Add temporal FOREIGN KEY contraints
authorPeter Eisentraut <[email protected]>
Tue, 17 Sep 2024 08:41:07 +0000 (10:41 +0200)
committerPeter Eisentraut <[email protected]>
Tue, 17 Sep 2024 09:29:30 +0000 (11:29 +0200)
commit89f908a6d0ac1337c868625008c9598487d184e7
tree921f1ed85307ba60fcca28b8513f18f78cb1e031
parentfc0438b4e80535419a4e54dba87642cdf84defda
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.

(previously committed as 34768ee3616, reverted by 8aee330af55; this is
essentially unchanged from those)

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