Re: Add CREATE SCHEMA ... LIKE support

From: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add CREATE SCHEMA ... LIKE support
Date: 2026-02-06 15:44:46
Message-ID: cabdf668-1834-48c1-b28f-c39183bb52db@gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 06/02/26 12:19, Marcos Pegoraro wrote:
>> I'd like to propose the introduction of the LIKE syntax on CREATE SCHEMA
>> command with the following syntax:
>> CREATE SCHEMA <name> LIKE <source_schema> [like_options...
>
>
> This feature is really cool.
> Having a function to clone schemas is what we use for these cases, so it
> would be very interesting to have a command that replaces that function.
> One observation is that you are using CREATE TABLE ... LIKE and this
> command does not respect some object names, like indexes and constraints.
> Your example idx_t1_name will clone as t1_name_idx
>
> So the cloned schema will not be exactly the same as the source.
> Maybe a rename process to match names from source to target next to CREATE
> TABLE LIKE would solve those cases.
>

Thanks for the input. I'll think about how to fix this for the next
version.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2026-02-06 15:45:20 Re: log_min_messages per backend type
Previous Message Florents Tselai 2026-02-06 15:36:34 doc: add note that wal_level=logical doesn't set up logical replication in itself