mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-27 02:07:19 +02:00
When ALTER TABLE .. ALTER CONSTRAINT changes deferrability properties changed in a partitioned table, we failed to propagate those changes correctly to partitions and to triggers. Repair by adding a recursion mechanism to affect all derived constraints and all derived triggers. (In particular, recurse to partitions even if their respective parents are already in the desired state: it is possible for the partitions to have been altered individually.) Because foreign keys involve tables in two sides, we cannot use the standard ALTER TABLE recursion mechanism, so we invent our own by following pg_constraint.conparentid down. When ALTER TABLE .. ALTER CONSTRAINT is invoked on the derived pg_constraint object that's automaticaly created in a partition as a result of a constraint added to its parent, raise an error instead of pretending to work and then failing to modify all the affected triggers. Before this commit such a command would be allowed but failed to affect all triggers, so it would silently misbehave. (Restoring dumps of existing databases is not affected, because pg_dump does not produce anything for such a derived constraint anyway.) Add some tests for the case. Backpatch to 11, where foreign key support was added to partitioned tables by commit |
||
---|---|---|
.. | ||
aggregatecmds.c | ||
alter.c | ||
amcmds.c | ||
analyze.c | ||
async.c | ||
cluster.c | ||
collationcmds.c | ||
comment.c | ||
constraint.c | ||
conversioncmds.c | ||
copy.c | ||
copyfrom.c | ||
copyfromparse.c | ||
copyto.c | ||
createas.c | ||
dbcommands.c | ||
define.c | ||
discard.c | ||
dropcmds.c | ||
event_trigger.c | ||
explain.c | ||
extension.c | ||
foreigncmds.c | ||
functioncmds.c | ||
indexcmds.c | ||
lockcmds.c | ||
Makefile | ||
matview.c | ||
opclasscmds.c | ||
operatorcmds.c | ||
policy.c | ||
portalcmds.c | ||
prepare.c | ||
proclang.c | ||
publicationcmds.c | ||
schemacmds.c | ||
seclabel.c | ||
sequence.c | ||
statscmds.c | ||
subscriptioncmds.c | ||
tablecmds.c | ||
tablespace.c | ||
trigger.c | ||
tsearchcmds.c | ||
typecmds.c | ||
user.c | ||
vacuum.c | ||
variable.c | ||
view.c |