On Thu Feb 12, 2026 at 5:38 PM -03, Álvaro Herrera wrote:
>> I was reading the TODO wiki page and found the "Add CREATE SCHEMA ...
>> LIKE that copies a schema" item and I thought that it could be a good
>> idea to have this at core.
>
> Egad.  A TODO thing from way back which probably doesn't make much sense
> nowadays, or at least so I think.
>
> This whole thing seems like a giant can of worms, and I'm not sure it's
> a good idea to add DDL syntax for it.  I didn't read the thread in
> detail, but the discussions downthread about adding weird clauses to
> CREATE SCHEMA look quite worrisome.
>
> Why not try to devise a way to reuse the DDL functions being proposed in
> various nearby pgsql-hackers threads?  There are a bunch of such patches
> in the commitfest already; it's probably easy to have a way to generate
> a list of objects in a schema, then call the DDL function corresponding
> to each object type for each object, and then you're done.

IIUC you'are suggesting to have something like pg_get_schema_ddl() which
would return the CREATE SCHEMA command and the DDL command used to
create the objects within the schema?

If that's the point it's sounds a better way to implement this. At some
point when I was writing the last version I thought that if we have
these patches already merged this LIKE clause could be implemented
easier but I was thinking to reuse with the LIKE clause, but creating a
function to get a schema definition seems more reasonable and follow the
same pattern for these other patches.

Thanks for the comments.

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


Reply via email to