diff options
author | Peter Eisentraut | 2024-05-16 06:15:35 +0000 |
---|---|---|
committer | Peter Eisentraut | 2024-05-16 06:17:46 +0000 |
commit | 8aee330af55d8a759b2b73f5a771d9d34a7b887f (patch) | |
tree | b917e26b4dbc6efa2a1c65124768d98eaf8fc92c /contrib/btree_gist/sql | |
parent | f6ebb418317a1e84be46e7e7b02a26d8c44984de (diff) |
Revert temporal primary keys and foreign keys
This feature set did not handle empty ranges correctly, and it's now
too late for PostgreSQL 17 to fix it.
The following commits are reverted:
6db4598fcb8 Add stratnum GiST support function
46a0cd4cefb Add temporal PRIMARY KEY and UNIQUE constraints
86232a49a43 Fix comment on gist_stratnum_btree
030e10ff1a3 Rename pg_constraint.conwithoutoverlaps to conperiod
a88c800deb6 Use daterange and YMD in without_overlaps tests instead of tsrange.
5577a71fb0c Use half-open interval notation in without_overlaps tests
34768ee3616 Add temporal FOREIGN KEY contraints
482e108cd38 Add test for REPLICA IDENTITY with a temporal key
c3db1f30cba doc: clarify PERIOD and WITHOUT OVERLAPS in CREATE TABLE
144c2ce0cc7 Fix ON CONFLICT DO NOTHING/UPDATE for temporal indexes
Discussion: https://www.postgresql.org/message-id/d0b64a7a-dfe4-4b84-a906-c7dedfa40a3e@eisentraut.org
Diffstat (limited to 'contrib/btree_gist/sql')
-rw-r--r-- | contrib/btree_gist/sql/stratnum.sql | 3 | ||||
-rw-r--r-- | contrib/btree_gist/sql/without_overlaps.sql | 53 |
2 files changed, 0 insertions, 56 deletions
diff --git a/contrib/btree_gist/sql/stratnum.sql b/contrib/btree_gist/sql/stratnum.sql deleted file mode 100644 index f58cdbe93da..00000000000 --- a/contrib/btree_gist/sql/stratnum.sql +++ /dev/null @@ -1,3 +0,0 @@ --- test stratnum support func -SELECT gist_stratnum_btree(3::smallint); -SELECT gist_stratnum_btree(18::smallint); diff --git a/contrib/btree_gist/sql/without_overlaps.sql b/contrib/btree_gist/sql/without_overlaps.sql deleted file mode 100644 index b1b581fcabc..00000000000 --- a/contrib/btree_gist/sql/without_overlaps.sql +++ /dev/null @@ -1,53 +0,0 @@ --- Core must test WITHOUT OVERLAPS --- with an int4range + daterange, --- so here we do some simple tests --- to make sure int + daterange works too, --- since that is the expected use-case. -CREATE TABLE temporal_rng ( - id integer, - valid_at daterange, - CONSTRAINT temporal_rng_pk PRIMARY KEY (id, valid_at WITHOUT OVERLAPS) -); -\d temporal_rng -SELECT pg_get_constraintdef(oid) FROM pg_constraint WHERE conname = 'temporal_rng_pk'; -SELECT pg_get_indexdef(conindid, 0, true) FROM pg_constraint WHERE conname = 'temporal_rng_pk'; - -INSERT INTO temporal_rng VALUES - (1, '[2000-01-01,2001-01-01)'); --- same key, doesn't overlap: -INSERT INTO temporal_rng VALUES - (1, '[2001-01-01,2002-01-01)'); --- overlaps but different key: -INSERT INTO temporal_rng VALUES - (2, '[2000-01-01,2001-01-01)'); --- should fail: -INSERT INTO temporal_rng VALUES - (1, '[2000-06-01,2001-01-01)'); - --- Foreign key -CREATE TABLE temporal_fk_rng2rng ( - id integer, - valid_at daterange, - parent_id integer, - CONSTRAINT temporal_fk_rng2rng_pk PRIMARY KEY (id, valid_at WITHOUT OVERLAPS), - CONSTRAINT temporal_fk_rng2rng_fk FOREIGN KEY (parent_id, PERIOD valid_at) - REFERENCES temporal_rng (id, PERIOD valid_at) -); -\d temporal_fk_rng2rng -SELECT pg_get_constraintdef(oid) FROM pg_constraint WHERE conname = 'temporal_fk_rng2rng_fk'; - --- okay -INSERT INTO temporal_fk_rng2rng VALUES - (1, '[2000-01-01,2001-01-01)', 1); --- okay spanning two parent records: -INSERT INTO temporal_fk_rng2rng VALUES - (2, '[2000-01-01,2002-01-01)', 1); --- key is missing -INSERT INTO temporal_fk_rng2rng VALUES - (3, '[2000-01-01,2001-01-01)', 3); --- key exist but is outside range -INSERT INTO temporal_fk_rng2rng VALUES - (4, '[2001-01-01,2002-01-01)', 2); --- key exist but is partly outside range -INSERT INTO temporal_fk_rng2rng VALUES - (5, '[2000-01-01,2002-01-01)', 2); |