diff options
| author | Peter Eisentraut | 2024-01-24 14:43:41 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2024-01-24 15:34:37 +0000 |
| commit | 46a0cd4cefb4d9b462d8cc4df5e7ecdd190bea92 (patch) | |
| tree | ccbcef511474ad69dd7472f0a35fe7813e47d909 /src/backend/nodes | |
| parent | 74a73063106583b1f49274a2cd1df42e35107361 (diff) | |
Add temporal PRIMARY KEY and UNIQUE constraints
Add WITHOUT OVERLAPS clause to PRIMARY KEY and UNIQUE constraints.
These are backed by GiST indexes instead of B-tree indexes, since they
are essentially exclusion constraints with = for the scalar parts of
the key and && for the temporal part.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: jian he <jian.universality@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mDHcY4_qQ0+noCUVg@mail.gmail.com
Diffstat (limited to 'src/backend/nodes')
| -rw-r--r-- | src/backend/nodes/outfuncs.c | 2 | ||||
| -rw-r--r-- | src/backend/nodes/readfuncs.c | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 296ba845187..03f67b68506 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -756,6 +756,7 @@ _outConstraint(StringInfo str, const Constraint *node) case CONSTR_PRIMARY: appendStringInfoString(str, "PRIMARY_KEY"); WRITE_NODE_FIELD(keys); + WRITE_BOOL_FIELD(without_overlaps); WRITE_NODE_FIELD(including); WRITE_NODE_FIELD(options); WRITE_STRING_FIELD(indexname); @@ -768,6 +769,7 @@ _outConstraint(StringInfo str, const Constraint *node) appendStringInfoString(str, "UNIQUE"); WRITE_BOOL_FIELD(nulls_not_distinct); WRITE_NODE_FIELD(keys); + WRITE_BOOL_FIELD(without_overlaps); WRITE_NODE_FIELD(including); WRITE_NODE_FIELD(options); WRITE_STRING_FIELD(indexname); diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c index 1624b345812..cfb552fde74 100644 --- a/src/backend/nodes/readfuncs.c +++ b/src/backend/nodes/readfuncs.c @@ -427,6 +427,7 @@ _readConstraint(void) case CONSTR_PRIMARY: READ_NODE_FIELD(keys); + READ_BOOL_FIELD(without_overlaps); READ_NODE_FIELD(including); READ_NODE_FIELD(options); READ_STRING_FIELD(indexname); @@ -438,6 +439,7 @@ _readConstraint(void) case CONSTR_UNIQUE: READ_BOOL_FIELD(nulls_not_distinct); READ_NODE_FIELD(keys); + READ_BOOL_FIELD(without_overlaps); READ_NODE_FIELD(including); READ_NODE_FIELD(options); READ_STRING_FIELD(indexname); |
