forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfc0438b
committed
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 theyare essentially exclusion constraints with = for the scalar parts ofthe key and && for the temporal part.(previously committed as46a0cd4, reverted by46a0cd4; the newpart is this:)Because 'empty' && 'empty' is false, the temporal PK/UQ constraintallowed duplicates, which is confusing to users and breaks internalexpectations. For instance, when GROUP BY checks functionaldependencies on the PK, it allows selecting other columns from thetable, but in the presence of duplicate keys you could get the valuefrom any of their rows. So we need to forbid empties.This all means that at the moment we can only support ranges andmultiranges for temporal PK/UQs, unlike the original patch (above).Documentation and tests for this are added. But this couldconceivably be extended by introducing some more general support forthe 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.com1 parent7406ab6 commitfc0438b
File tree
37 files changed
+2848
-62
lines changed- contrib/btree_gist
- expected
- sql
- doc/src/sgml
- ref
- src
- backend
- access/gist
- catalog
- commands
- executor
- nodes
- optimizer/util
- parser
- utils
- adt
- cache
- bin
- pg_dump
- t
- psql
- include
- access
- catalog
- commands
- nodes
- test/regress
- expected
- sql
37 files changed
+2848
-62
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
40 | 40 |
| |
41 | 41 |
| |
42 | 42 |
| |
43 |
| - | |
| 43 | + | |
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
|
Lines changed: 44 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
| 94 | + | |
94 | 95 |
| |
95 | 96 |
| |
96 | 97 |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + |
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2730 | 2730 |
| |
2731 | 2731 |
| |
2732 | 2732 |
| |
| 2733 | + | |
| 2734 | + | |
| 2735 | + | |
| 2736 | + | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
2733 | 2743 |
| |
2734 | 2744 |
| |
2735 | 2745 |
| |
|
Lines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
292 | 292 |
| |
293 | 293 |
| |
294 | 294 |
| |
295 |
| - | |
| 295 | + | |
| 296 | + | |
296 | 297 |
| |
297 | 298 |
| |
298 | 299 |
| |
| |||
1179 | 1180 |
| |
1180 | 1181 |
| |
1181 | 1182 |
| |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
1182 | 1191 |
| |
1183 | 1192 |
| |
1184 | 1193 |
| |
|
Lines changed: 31 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
80 |
| - | |
81 |
| - | |
| 80 | + | |
| 81 | + | |
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| |||
964 | 964 |
| |
965 | 965 |
| |
966 | 966 |
| |
967 |
| - | |
| 967 | + | |
968 | 968 |
| |
969 | 969 |
| |
970 | 970 |
| |
| |||
978 | 978 |
| |
979 | 979 |
| |
980 | 980 |
| |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
981 | 1002 |
| |
982 | 1003 |
| |
983 | 1004 |
| |
| |||
1000 | 1021 |
| |
1001 | 1022 |
| |
1002 | 1023 |
| |
1003 |
| - | |
1004 |
| - | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
1005 | 1028 |
| |
1006 | 1029 |
| |
1007 | 1030 |
| |
| |||
1019 | 1042 |
| |
1020 | 1043 |
| |
1021 | 1044 |
| |
1022 |
| - | |
| 1045 | + | |
1023 | 1046 |
| |
1024 | 1047 |
| |
1025 | 1048 |
| |
| |||
1054 | 1077 |
| |
1055 | 1078 |
| |
1056 | 1079 |
| |
1057 |
| - | |
1058 |
| - | |
| 1080 | + | |
| 1081 | + | |
1059 | 1082 |
| |
1060 | 1083 |
| |
1061 | 1084 |
| |
|
Lines changed: 29 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1069 | 1069 |
| |
1070 | 1070 |
| |
1071 | 1071 |
| |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + |
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2163 | 2163 |
| |
2164 | 2164 |
| |
2165 | 2165 |
| |
| 2166 | + | |
2166 | 2167 |
| |
2167 | 2168 |
| |
2168 | 2169 |
| |
|
Lines changed: 10 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1394 | 1394 |
| |
1395 | 1395 |
| |
1396 | 1396 |
| |
1397 |
| - | |
| 1397 | + | |
| 1398 | + | |
1398 | 1399 |
| |
1399 | 1400 |
| |
1400 | 1401 |
| |
| |||
1874 | 1875 |
| |
1875 | 1876 |
| |
1876 | 1877 |
| |
| 1878 | + | |
1877 | 1879 |
| |
1878 | 1880 |
| |
1879 | 1881 |
| |
| |||
1897 | 1899 |
| |
1898 | 1900 |
| |
1899 | 1901 |
| |
| 1902 | + | |
1900 | 1903 |
| |
1901 | 1904 |
| |
1902 | 1905 |
| |
1903 | 1906 |
| |
1904 | 1907 |
| |
| 1908 | + | |
1905 | 1909 |
| |
1906 | 1910 |
| |
1907 | 1911 |
| |
| |||
1978 | 1982 |
| |
1979 | 1983 |
| |
1980 | 1984 |
| |
| 1985 | + | |
1981 | 1986 |
| |
1982 | 1987 |
| |
1983 | 1988 |
| |
| |||
2427 | 2432 |
| |
2428 | 2433 |
| |
2429 | 2434 |
| |
2430 |
| - | |
| 2435 | + | |
| 2436 | + | |
2431 | 2437 |
| |
2432 | 2438 |
| |
2433 | 2439 |
| |
| |||
2486 | 2492 |
| |
2487 | 2493 |
| |
2488 | 2494 |
| |
2489 |
| - | |
| 2495 | + | |
| 2496 | + | |
2490 | 2497 |
| |
2491 | 2498 |
| |
2492 | 2499 |
| |
| |||
3224 | 3231 |
| |
3225 | 3232 |
| |
3226 | 3233 |
| |
3227 |
| - | |
3228 | 3234 |
| |
3229 | 3235 |
| |
3230 | 3236 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
75 | 75 |
| |
76 | 76 |
| |
77 | 77 |
| |
| 78 | + | |
78 | 79 |
| |
79 | 80 |
| |
80 | 81 |
| |
| |||
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
| 194 | + | |
193 | 195 |
| |
194 | 196 |
| |
195 | 197 |
| |
|
0 commit comments
Comments
(0)