postgresql/src
Alvaro Herrera b0284bfb1d
Create FKs properly when attaching table as partition
Commit f56f8f8da6 added some code in CloneFkReferencing that's way too
lax about a Constraint node it manufactures, not initializing enough
struct members -- initially_valid in particular was forgotten.  This
causes some FKs in partitions added by ALTER TABLE ATTACH PARTITION to
be marked as not validated.  Set initially_valid true, which fixes the
bug.

While at it, make the struct initialization more complete.  Very similar
code was added in two other places by the same commit; make them all
follow the same pattern for consistency, though no bugs are apparent
there.

This bug has never been reported: I only happened to notice while
working on commit 614a406b4f.  The test case that was added there with
the improper result is repaired.

Backpatch to 12.

Discussion: https://postgr.es/m/20221005105523.bhuhkdx4olajboof@alvherre.pgsql
2022-11-03 20:40:21 +01:00
..
backend Create FKs properly when attaching table as partition 2022-11-03 20:40:21 +01:00
bin pg_dump: Refactor code that constructs ALTER ... OWNER TO commands 2022-11-02 17:24:38 -04:00
common Remove AssertArg and AssertState 2022-10-28 09:19:06 +02:00
fe_utils meson: Add support for building with precompiled headers 2022-10-06 17:19:30 -07:00
include Make AssertPointerAlignment available to frontend code 2022-11-03 12:04:22 -04:00
interfaces libpq: Reset singlerow flag correctly in pipeline mode 2022-10-14 19:06:26 +02:00
makefiles autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
pl Store GUC data in a memory context, instead of using malloc(). 2022-10-14 12:10:48 -04:00
port Fix unlink() for STATUS_DELETE_PENDING on Windows. 2022-10-25 16:26:58 +13:00
template Move darwin sysroot determination into separate file 2022-09-01 16:54:19 -07:00
test Create FKs properly when attaching table as partition 2022-11-03 20:40:21 +01:00
timezone Update time zone data files to tzdata release 2022f. 2022-11-01 17:08:28 -04:00
tools Add doubly linked count list implementation 2022-11-02 14:06:05 +13:00
tutorial Update copyright for 2022 2022-01-07 19:04:57 -05:00
.gitignore
DEVELOPERS
Makefile Remove the option to build thread_test.c outside configure. 2020-10-21 12:08:48 -04:00
Makefile.global.in Make finding openssl program a configure or meson option 2022-10-20 21:05:42 +02:00
Makefile.shlib autoconf: Rely on ar supporting index creation 2022-10-07 11:53:39 -07:00
meson.build meson: Add initial version of meson based build system 2022-09-21 22:37:17 -07:00
nls-global.mk Fix for make unportability 2022-07-13 09:15:01 +02:00