pgsql: Add temporal FOREIGN KEY contraints
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. Author: Paul A. Jungwirth Reviewed-by: Peter Eisentraut Reviewed-by: jian he Discussion: https://www.postgresql.org/message-id/flat/CA+renyUApHgSZF9-nd-a0+OPGharLQLO=mdhcy4_qq0+noc...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/34768ee361656841a122f1c8d52a2ad753612feb Modified Files -- contrib/btree_gist/expected/without_overlaps.out | 48 + contrib/btree_gist/sql/without_overlaps.sql | 28 + doc/src/sgml/catalogs.sgml |3 +- doc/src/sgml/ref/create_table.sgml | 43 +- src/backend/catalog/pg_constraint.c | 58 ++ src/backend/commands/indexcmds.c | 31 +- src/backend/commands/tablecmds.c | 226 - src/backend/parser/gram.y| 45 +- src/backend/utils/adt/ri_triggers.c | 168 +++- src/backend/utils/adt/ruleutils.c| 17 +- src/include/catalog/pg_constraint.h | 21 +- src/include/commands/defrem.h|2 +- src/include/nodes/parsenodes.h |2 + src/include/parser/kwlist.h |1 + src/test/regress/expected/without_overlaps.out | 1159 +- src/test/regress/sql/without_overlaps.sql| 1056 +++- 16 files changed, 2790 insertions(+), 118 deletions(-)
pgsql: amcheck: Support for different header sizes of short varlena dat
amcheck: Support for different header sizes of short varlena datum In the heap, tuples may contain short varlena datum with both 1B header and 4B headers. But the corresponding index tuple should always have such varlena's with 1B headers. So, for fingerprinting, we need to convert. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Michael Zhilin Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ab65dfb0fb2908989c0ef3330464b7af171e9728 Modified Files -- contrib/amcheck/expected/check_btree.out | 13 contrib/amcheck/sql/check_btree.sql | 11 ++ contrib/amcheck/verify_nbtree.c | 36 +++- 3 files changed, 55 insertions(+), 5 deletions(-)
pgsql: amcheck: Normalize index tuples containing uncompressed varlena
amcheck: Normalize index tuples containing uncompressed varlena It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b1fe8efdf17eb4877f7c4c31c85111ec740ad872 Modified Files -- contrib/amcheck/expected/check_btree.out | 10 ++ contrib/amcheck/sql/check_btree.sql | 6 ++ contrib/amcheck/verify_nbtree.c | 13 + 3 files changed, 29 insertions(+)
pgsql: amcheck: Support for different header sizes of short varlena dat
amcheck: Support for different header sizes of short varlena datum In the heap, tuples may contain short varlena datum with both 1B header and 4B headers. But the corresponding index tuple should always have such varlena's with 1B headers. So, for fingerprinting, we need to convert. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Michael Zhilin Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a6ddb8ad0ad0947bf86e8cd99c87b156f0956228 Modified Files -- contrib/amcheck/expected/check_btree.out | 13 contrib/amcheck/sql/check_btree.sql | 11 ++ contrib/amcheck/verify_nbtree.c | 36 +++- 3 files changed, 55 insertions(+), 5 deletions(-)
pgsql: amcheck: Normalize index tuples containing uncompressed varlena
amcheck: Normalize index tuples containing uncompressed varlena It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0d466bce9ee19a5f7ef6c2964376aa6572ef76fd Modified Files -- contrib/amcheck/expected/check_btree.out | 10 ++ contrib/amcheck/sql/check_btree.sql | 6 ++ contrib/amcheck/verify_nbtree.c | 13 + 3 files changed, 29 insertions(+)
pgsql: amcheck: Normalize index tuples containing uncompressed varlena
amcheck: Normalize index tuples containing uncompressed varlena It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_16_STABLE Details --- https://git.postgresql.org/pg/commitdiff/3676b846b129b975034927cdf5f57297211d6f15 Modified Files -- contrib/amcheck/expected/check_btree.out | 10 ++ contrib/amcheck/sql/check_btree.sql | 6 ++ contrib/amcheck/verify_nbtree.c | 13 + 3 files changed, 29 insertions(+)
pgsql: amcheck: Support for different header sizes of short varlena dat
amcheck: Support for different header sizes of short varlena datum In the heap, tuples may contain short varlena datum with both 1B header and 4B headers. But the corresponding index tuple should always have such varlena's with 1B headers. So, for fingerprinting, we need to convert. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Michael Zhilin Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_15_STABLE Details --- https://git.postgresql.org/pg/commitdiff/54e6184db3613e868ca7f042aebe69393fd73b96 Modified Files -- contrib/amcheck/expected/check_btree.out | 13 contrib/amcheck/sql/check_btree.sql | 11 ++ contrib/amcheck/verify_nbtree.c | 36 +++- 3 files changed, 55 insertions(+), 5 deletions(-)
pgsql: amcheck: Normalize index tuples containing uncompressed varlena
amcheck: Normalize index tuples containing uncompressed varlena It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/4e8529da48baf780f2a2c7e0255a0c9ea02b0d11 Modified Files -- contrib/amcheck/expected/check_btree.out | 10 ++ contrib/amcheck/sql/check_btree.sql | 6 ++ contrib/amcheck/verify_nbtree.c | 13 + 3 files changed, 29 insertions(+)
pgsql: amcheck: Support for different header sizes of short varlena dat
amcheck: Support for different header sizes of short varlena datum In the heap, tuples may contain short varlena datum with both 1B header and 4B headers. But the corresponding index tuple should always have such varlena's with 1B headers. So, for fingerprinting, we need to convert. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Michael Zhilin Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/e2c241416515ec9dd711296385ab420e1afc4864 Modified Files -- contrib/amcheck/expected/check_btree.out | 13 contrib/amcheck/sql/check_btree.sql | 11 ++ contrib/amcheck/verify_nbtree.c | 36 +++- 3 files changed, 55 insertions(+), 5 deletions(-)
pgsql: amcheck: Support for different header sizes of short varlena dat
amcheck: Support for different header sizes of short varlena datum In the heap, tuples may contain short varlena datum with both 1B header and 4B headers. But the corresponding index tuple should always have such varlena's with 1B headers. So, for fingerprinting, we need to convert. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Michael Zhilin Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/50f8611d073e255c9d5b3792965595879c22c610 Modified Files -- contrib/amcheck/expected/check_btree.out | 13 contrib/amcheck/sql/check_btree.sql | 11 ++ contrib/amcheck/verify_nbtree.c | 36 +++- 3 files changed, 55 insertions(+), 5 deletions(-)
pgsql: amcheck: Normalize index tuples containing uncompressed varlena
amcheck: Normalize index tuples containing uncompressed varlena It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d603e674462d7c4df0e88b7a61d4ae14ae3ed191 Modified Files -- contrib/amcheck/expected/check_btree.out | 10 ++ contrib/amcheck/sql/check_btree.sql | 6 ++ contrib/amcheck/verify_nbtree.c | 13 + 3 files changed, 29 insertions(+)
pgsql: amcheck: Support for different header sizes of short varlena dat
amcheck: Support for different header sizes of short varlena datum In the heap, tuples may contain short varlena datum with both 1B header and 4B headers. But the corresponding index tuple should always have such varlena's with 1B headers. So, for fingerprinting, we need to convert. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Michael Zhilin Reviewed-by: Alexander Lakhin, Andrey Borodin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/5df5d9cd7ea4f40f6e3efec650bdc7615b6d16ed Modified Files -- contrib/amcheck/expected/check_btree.out | 13 contrib/amcheck/sql/check_btree.sql | 11 ++ contrib/amcheck/verify_nbtree.c | 36 +++- 3 files changed, 55 insertions(+), 5 deletions(-)
pgsql: amcheck: Normalize index tuples containing uncompressed varlena
amcheck: Normalize index tuples containing uncompressed varlena It might happen that the varlena value wasn't compressed by index_form_tuple() due to current storage parameters. If compression is currently enabled, we need to compress such values to match index tuple coming from the heap. Backpatch to all supported versions. Discussion: https://postgr.es/m/flat/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc%40postgrespro.ru Author: Andrey Borodin Reviewed-by: Alexander Lakhin, Michael Zhilin, Jian He, Alexander Korotkov Backpatch-through: 12 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/5cc1f2626369536c191009bf084c9d1f456abc7a Modified Files -- contrib/amcheck/expected/check_btree.out | 10 ++ contrib/amcheck/sql/check_btree.sql | 6 ++ contrib/amcheck/verify_nbtree.c | 13 + 3 files changed, 29 insertions(+)
pgsql: Remove incorrect Assert introduced in c8aeaf3ab.
Remove incorrect Assert introduced in c8aeaf3ab. Already removed incidentally in version 15 (c4649cce3), so this commit is only applied to versions 13 and 14. The comment above is misleading in all versions 13 and later, so that will be fixed in a separate commit. Discussion: https://postgr.es/m/cfd84cb8-12fe-433a-a4bb-f460a4515f9c.zhaotinghai.zth%40alibaba-inc.com Reported-by: Tinghai Zhao Backpatch-through: 13 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/bf038eb219bb6c7dc8a8de58de3513c035a5efba Modified Files -- src/backend/utils/sort/logtape.c | 7 --- 1 file changed, 7 deletions(-)
pgsql: Remove incorrect Assert introduced in c8aeaf3ab.
Remove incorrect Assert introduced in c8aeaf3ab. Already removed incidentally in version 15 (c4649cce3), so this commit is only applied to versions 13 and 14. The comment above is misleading in all versions 13 and later, so that will be fixed in a separate commit. Discussion: https://postgr.es/m/cfd84cb8-12fe-433a-a4bb-f460a4515f9c.zhaotinghai.zth%40alibaba-inc.com Reported-by: Tinghai Zhao Backpatch-through: 13 Branch -- REL_14_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a1a51dc4fab7efdcf3c3a50d9dd9f0a4a420f4f7 Modified Files -- src/backend/utils/sort/logtape.c | 8 1 file changed, 8 deletions(-)