| From: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com> |
|---|---|
| To: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Add CREATE SCHEMA ... LIKE support |
| Date: | 2026-02-06 14:42:29 |
| Message-ID: | 52069dec-ff84-4f20-b6d0-cb2507ab0f50@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 06/02/26 11:35, Jim Jones 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...]
>>
>> Where like_options is:
>> { INCLUDING | EXCLUDING } { TABLE | INDEX | ... | ALL }
>>
>> The idea of LIKE syntax is to create a new schema with all objects that
>> exist on source schema like tables, indexes, sequences, functions,
>> views, etc.
>
>
> I generally like the idea.
>
> One quick note:
>
> I'm just wondering if using a similar syntax as IMPORT FOREIGN SCHEMA
> would be better than creating a new one
>
>
> IMPORT FOREIGN SCHEMA remote_schema
> [ { LIMIT TO | EXCEPT } ( table_name [, ...] ) ]
> FROM SERVER server_name
> INTO local_schema
> [ OPTIONS ( option 'value' [, ... ] ) ]
>
>
> So EXCEPT instead of EXCLUDING and LIMIT TO instead of INCLUDING. Of
> course, assuming the proposed syntax isn't already defined in the SQL
> standard.
>
Yeah, it could be an option but IMHO adding the LIKE on CREATE SCHEMA
sounds more similar to what we already have for CREATE TABLE ... LIKE.
Although I prefer the CREATE SCHEMA LIKE syntax I'm open to discuss
about other syntaxes.
--
Matheus Alcantara
EDB: https://www.enterprisedb.com
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2026-02-06 14:49:01 | Re: CREATE TABLE LIKE INCLUDING TRIGGERS |
| Previous Message | Chengpeng Yan | 2026-02-06 14:37:59 | Re: Unfortunate pushing down of expressions below sort |