On 2019-Feb-19, Robert Haas wrote: > It's not unreasonable to use the parent's REPLICA IDENTITY setting as > the default for new partitions, much as we now do for the TABLESPACE, > because the parent's replica identity is otherwise without meaning. > But I'm less convinced that it's reasonable to have changing the > parent's replica identity recurse to existing children, because: > > 1. That's different from the TABLESPACE case. We shouldn't just treat > each new instance of this problem as a green field where we can pick > any old behavior at random; it should be consistent as far as > reasonable,
Maybe we should be using the inheritance marker in the command to note whether to recurse to partitions? That is, if you say ALTER TABLE ONLY parent SET REPLICA IDENTITY then we don't recurse and just change the parent table and future partitions, whereas if you leave out the ONLY then it does affect existing partitions. However, I think TABLESPACE and any other property that involves rewriting tables wholesale can reasonably be expected to behave differently (w.r.t. recursing) from commands that just modify the catalogs. I think we already have such a distinction somewhere. EXPLAIN ALTER TABLE would sure be handy :-) > 2. It confuses a change to the default for new partitions with a > change to the value for existing partitions. Say that you've got 5 > existing partitions that use one setting, but now you want new > partitions to use a different setting. You can't get that with your > proposed semantics, because trying to change the default will change > all the existing partitions to the new value also, even though that's > not what you wanted. If we make sure to heed ONLY (and I admit to not thinking about it in my original patch) then I think this angle is covered. > We should really, really try to figure out all of the things that are > like this -- a property that is meaningless for the partitioned table > itself but may serve as a useful default for its children -- and try > to make them all work the same, ideally in one release, rather than > changing them at different times, back-patching sometimes, and having > no consistency in the details. I have no argument against somebody doing that, but I don't think I have the resources to do in in time for 12; on the other hand, leaving a known misfeature unfixed because nobody has looked for hypothetical similar bugs would be bad. I'm not proposing to back-patch this, but I would love it if I can borrow somebody's time machine to retroactively fix it for 11.0. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services