On 2021-May-03, Alvaro Herrera wrote:
> There is a case where it doesn't seem like we can easily give
> non-surprising behavior: when multi-level partitioning is used, a
> constraint is defined in the top level and then it is altered in the
> middle level, then we don't have access to the action triggers, because
> those are defined at the parent level. I opted for adding a WARNING
> message in that case. Other options were 1) to raise an error if
> altering a constraint that's not top level, but I fear that might break
> restoring dumps of existing database;
Actually, I tested this and it turns out to be a nonexistant problem: if
you alter a constraint that's not top-level, then pg_dump silently omits
the deferrability change there. So we can just have this emit ERROR and
nothing that works today would break. Users *would* get an error, but
then the alteration would not have the desired effect anyway. I suppose
we would have already got complaints if anybody were trying. (The error
message could stand some wording improvement ...)
So the attached version does that and I intend to get it pushed to all
branches (since 11) this afternoon unless I get any objections.
I'm CC'ing Ron as the reporter of the original bug.
--
Álvaro Herrera Valdivia, Chile