On Thu, Apr 11, 2024 at 9:54 PM Alexander Korotkov <aekorot...@gmail.com> wrote: > I think we shouldn't unconditionally copy schema name and > relpersistence from the parent table. Instead we should throw the > error on a mismatch like CREATE TABLE ... PARTITION OF ... does. I'm > working on revising this fix.
We definitely shouldn't copy the schema name from the parent table. It should be possible to schema-qualify the new partition names, and if you don't, then the search_path should determine where they get placed. But I am inclined to think that relpersistence should be copied. It's weird that you split an unlogged partition and you get logged partitions. One of the things I dislike about this type of feature -- not this implementation specifically, but just this kind of idea in general -- is that the syntax mentions a whole bunch of tables but in a way where you can't set their properties. Persistence, reloptions, whatever. There's just no place to mention any of that stuff - and if you wanted to create a place, you'd have to invent special syntax for each separate thing. That's why I think it's good that the normal way of creating a partition is CREATE TABLE .. PARTITION OF. Because that way, we know that the full power of the CREATE TABLE statement is always available, and you can set anything that you could set for a table that is not a partition. Of course, that is not to say that some people won't like to have a feature of this sort. I expect they will. The approach does have some drawbacks, though. -- Robert Haas EDB: http://www.enterprisedb.com