| From: | Jim Jones <jim(dot)jones(at)uni-muenster(dot)de> |
|---|---|
| To: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Add CREATE SCHEMA ... LIKE support |
| Date: | 2026-02-06 14:35:09 |
| Message-ID: | ae6443da-8757-4633-a3e6-4343b86638e4@uni-muenster.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Matheus
On 06/02/2026 15:22, Matheus Alcantara 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.
Best, Jim
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chengpeng Yan | 2026-02-06 14:37:59 | Re: Unfortunate pushing down of expressions below sort |
| Previous Message | Matheus Alcantara | 2026-02-06 14:22:46 | Add CREATE SCHEMA ... LIKE support |