| From: | Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> |
|---|---|
| To: | Matheus Alcantara <matheusssilv97(at)gmail(dot)com> |
| Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: Add CREATE SCHEMA ... LIKE support |
| Date: | 2026-02-06 15:19:03 |
| Message-ID: | CAB-JLwYmu8FJotpOH-B_EUpapx8ksung8uhgF-hO1miheSh19Q@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Em sex., 6 de fev. de 2026 às 11:22, Matheus Alcantara <
matheusssilv97(at)gmail(dot)com> escreveu:
> 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.
regards
Marcos
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jim Jones | 2026-02-06 15:23:45 | Re: Add CREATE SCHEMA ... LIKE support |
| Previous Message | Tom Lane | 2026-02-06 15:11:51 | Re: [PING] fallocate() causes btrfs to never compress postgresql files |