On 10/02/2026 11:09, Jim Jones wrote:
> In a scenario where a parent table and the partitioned tables live in
> different schemas, creating a schema based on the schema that contains
> only the partitions arguably generates useless tables.
> The same applies for creating schema that contains only the parent table
> Even if parent and children live in the same schema, they become
> detached in the new copy -- I'd argue that this one is a bug.
> Comments are also being ignored, but I guess it was already mentioned
> upthread:
I also just noticed that UNLOGGED tables are cloned as normal tables:
postgres=# CREATE SCHEMA s1;
CREATE UNLOGGED TABLE s1.t(c int);
CREATE SCHEMA s2 LIKE s1 INCLUDING ALL;
CREATE SCHEMA
CREATE TABLE
CREATE SCHEMA
postgres=# \d s1.t
Unlogged table "s1.t"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
c | integer | | |
postgres=# \d s2.t
Table "s2.t"
Column | Type | Collation | Nullable | Default
--------+---------+-----------+----------+---------
c | integer | | |
Adding this to collectSchemaTablesLike in schemacmds.c could do the trick:
newRelation->relpersistence = classForm->relpersistence;
Best, Jim
- Re: Add CREATE SCHEMA ... LIKE support Marcos Pegoraro
- Re: Add CREATE SCHEMA ... LIKE support Matheus Alcantara
- Add CREATE SCHEMA ... LIKE support David G. Johnston
- Re: Add CREATE SCHEMA ... LIKE support Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE support Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE support Marcos Pegoraro
- Re: Add CREATE SCHEMA ... LIKE support Marcos Pegoraro
- Re: Add CREATE SCHEMA ... LIKE sup... Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE support Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE sup... Jim Jones
- Re: Add CREATE SCHEMA ... LIKE... Jim Jones
- Re: Add CREATE SCHEMA ... LIKE... Marcos Pegoraro
- Re: Add CREATE SCHEMA ... LIKE... Jim Jones
- Re: Add CREATE SCHEMA ... LIKE... Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE... David G. Johnston
- Re: Add CREATE SCHEMA ... LIKE... Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE... Jim Jones
- Re: Add CREATE SCHEMA ... LIKE... Matheus Alcantara
- Re: Add CREATE SCHEMA ... LIKE... Jim Jones
- Re: Add CREATE SCHEMA ... LIKE... Marcos Pegoraro
- Re: Add CREATE SCHEMA ... LIKE... Matheus Alcantara
