postgres/contrib/btree_gist
Peter Eisentraut fc0438b4e8 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.

(previously committed as 46a0cd4cef, reverted by 46a0cd4cefb; the new
part is this:)

Because 'empty' && 'empty' is false, the temporal PK/UQ constraint
allowed duplicates, which is confusing to users and breaks internal
expectations.  For instance, when GROUP BY checks functional
dependencies on the PK, it allows selecting other columns from the
table, but in the presence of duplicate keys you could get the value
from any of their rows.  So we need to forbid empties.

This all means that at the moment we can only support ranges and
multiranges for temporal PK/UQs, unlike the original patch (above).
Documentation and tests for this are added.  But this could
conceivably be extended by introducing some more general support for
the notion of "empty" for other types.

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
2024-09-17 11:29:30 +02:00
..
data Add btree_gist support for enum types. 2017-03-21 10:43:27 -04:00
expected Add temporal PRIMARY KEY and UNIQUE constraints 2024-09-17 11:29:30 +02:00
sql Add temporal PRIMARY KEY and UNIQUE constraints 2024-09-17 11:29:30 +02:00
.gitignore
btree_bit.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
btree_bool.c Pre-beta mechanical code beautification. 2022-05-12 15:17:30 -04:00
btree_bytea.c Revert "Add sortsupport for gist_btree opclasses, for faster index builds." 2021-04-07 14:33:21 +03:00
btree_cash.c Use C library functions instead of Abs() for int64 2022-10-10 09:01:17 +02:00
btree_date.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_enum.c Revert "Add sortsupport for gist_btree opclasses, for faster index builds." 2021-04-07 14:33:21 +03:00
btree_float4.c Use fabsf() instead of Abs() or fabs() where appropriate 2022-10-08 13:43:26 +02:00
btree_float8.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_gist--1.1--1.2.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
btree_gist--1.2--1.3.sql Add uuid to the set of types supported by contrib/btree_gist. 2016-11-29 14:08:34 -05:00
btree_gist--1.2.sql
btree_gist--1.3--1.4.sql Add support for EUI-64 MAC addresses as macaddr8 2017-03-15 11:16:25 -04:00
btree_gist--1.4--1.5.sql Add btree_gist support for enum types. 2017-03-21 10:43:27 -04:00
btree_gist--1.5--1.6.sql Update btree_gist extension for parallel query 2020-07-20 13:59:50 +03:00
btree_gist--1.6--1.7.sql Fix gist_bool_ops to use gbtreekey2 2021-11-08 01:14:55 +01:00
btree_gist--1.7--1.8.sql Add stratnum GiST support function 2024-09-17 11:29:29 +02:00
btree_gist--1.0--1.1.sql
btree_gist.c Add stratnum GiST support function 2024-09-17 11:29:29 +02:00
btree_gist.control Add stratnum GiST support function 2024-09-17 11:29:29 +02:00
btree_gist.h Add trailing commas to enum definitions 2023-10-26 09:20:54 +02:00
btree_inet.c Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
btree_int2.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_int4.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_int8.c Use C library functions instead of Abs() for int64 2022-10-10 09:01:17 +02:00
btree_interval.c Mark misc static global variables as const 2024-08-06 23:04:48 +03:00
btree_macaddr.c Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
btree_macaddr8.c Remove extraneous blank lines before block-closing braces 2022-04-13 19:16:02 +02:00
btree_numeric.c Revert "Add sortsupport for gist_btree opclasses, for faster index builds." 2021-04-07 14:33:21 +03:00
btree_oid.c Revert "Add sortsupport for gist_btree opclasses, for faster index builds." 2021-04-07 14:33:21 +03:00
btree_text.c Fix results of index-only scans on btree_gist char(N) indexes. 2022-01-08 14:54:39 -05:00
btree_time.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_ts.c Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_utils_num.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
btree_utils_num.h Remove unnecessary uses of Abs() 2022-10-07 13:29:33 +02:00
btree_utils_var.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
btree_utils_var.h Make the order of the header file includes consistent. 2019-11-25 08:08:57 +05:30
btree_uuid.c Remove useless casts to (void *) in arguments of some system functions 2023-02-07 06:57:59 +01:00
Makefile Add temporal PRIMARY KEY and UNIQUE constraints 2024-09-17 11:29:30 +02:00
meson.build Add temporal PRIMARY KEY and UNIQUE constraints 2024-09-17 11:29:30 +02:00