postgresql/src
Alvaro Herrera ab70b3a52f
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_basebackup: Fix cross-platform tablespace relocation. 2022-10-21 08:59:26 -04:00
common
fe_utils
include Allow use of __sync_lock_test_and_set for spinlocks on any machine. 2022-11-02 17:37:26 -04:00
interfaces Fix possible omission of variable storage markers in ECPG. 2022-09-09 15:34:04 -04:00
makefiles
pl Improve plpgsql's ability to handle arguments declared as RECORD. 2022-09-16 13:23:01 -04:00
port Use libc's snprintf, not sprintf, for special cases in snprintf.c. 2022-10-16 11:47:44 -04:00
template
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:09:09 -04:00
tools
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in
Makefile.shlib
nls-global.mk