Commit b0284bf
committed
Create FKs properly when attaching table as partition
Commit f56f8f8 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 614a406. The test case that was added there with
the improper result is repaired.
Backpatch to 12.
Discussion: https://postgr.es/m/20221005105523.bhuhkdx4olajboof@alvherre.pgsql1 parent 2fe4c73 commit b0284bf
File tree
2 files changed
+40
-10
lines changed- src
- backend/commands
- test/regress/expected
2 files changed
+40
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10092 | 10092 | | |
10093 | 10093 | | |
10094 | 10094 | | |
10095 | | - | |
| 10095 | + | |
10096 | 10096 | | |
10097 | | - | |
10098 | | - | |
10099 | 10097 | | |
10100 | 10098 | | |
10101 | | - | |
| 10099 | + | |
| 10100 | + | |
| 10101 | + | |
| 10102 | + | |
10102 | 10103 | | |
| 10104 | + | |
| 10105 | + | |
| 10106 | + | |
| 10107 | + | |
| 10108 | + | |
| 10109 | + | |
| 10110 | + | |
10103 | 10111 | | |
10104 | 10112 | | |
10105 | 10113 | | |
| |||
10317 | 10325 | | |
10318 | 10326 | | |
10319 | 10327 | | |
10320 | | - | |
10321 | | - | |
| 10328 | + | |
| 10329 | + | |
10322 | 10330 | | |
10323 | 10331 | | |
| 10332 | + | |
| 10333 | + | |
| 10334 | + | |
| 10335 | + | |
10324 | 10336 | | |
| 10337 | + | |
| 10338 | + | |
| 10339 | + | |
| 10340 | + | |
| 10341 | + | |
| 10342 | + | |
| 10343 | + | |
10325 | 10344 | | |
10326 | 10345 | | |
10327 | 10346 | | |
| |||
18517 | 18536 | | |
18518 | 18537 | | |
18519 | 18538 | | |
| 18539 | + | |
18520 | 18540 | | |
18521 | | - | |
18522 | | - | |
18523 | 18541 | | |
18524 | 18542 | | |
| 18543 | + | |
| 18544 | + | |
| 18545 | + | |
| 18546 | + | |
| 18547 | + | |
| 18548 | + | |
| 18549 | + | |
| 18550 | + | |
| 18551 | + | |
| 18552 | + | |
| 18553 | + | |
| 18554 | + | |
18525 | 18555 | | |
18526 | 18556 | | |
18527 | 18557 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2031 | 2031 | | |
2032 | 2032 | | |
2033 | 2033 | | |
2034 | | - | |
| 2034 | + | |
2035 | 2035 | | |
2036 | 2036 | | |
2037 | 2037 | | |
| |||
2060 | 2060 | | |
2061 | 2061 | | |
2062 | 2062 | | |
2063 | | - | |
| 2063 | + | |
2064 | 2064 | | |
2065 | 2065 | | |
2066 | 2066 | | |
| |||
0 commit comments