Schema renaming cascade

From: Lorusso Domenico <domenico(dot)l76(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Schema renaming cascade
Date: 2023-08-17 15:43:26
Message-ID: CAJMpnG6Ai7tfBCQ+XiA1d3UFc=fpD5f0tCFgu49O2orfuawCzw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello guys,
I need to rename a schema, including each reference to it (also for
functions)

I mean:
I've 2 schemas called "schema1" and "schema2".
In schema1 there are tables, composite types, and functions
Functions call other functions in the same schema

In schema2
Also in schema2 there are tables, composite types, and functions
Plus many function and tables refer to object of schema1

I need to rename schema1 to schema 3 substituting any reference to schema1
with schema3
Is there a way to to that?

I found this answer
<https://www.postgresql.org/message-id/CANu8FiyJtt-0q%3DbkUxyra66tHi6FFzgU8TqVR2aahseCBDDntA%40mail.gmail.com>
that
clone a schema (that solve partially the problem) but is it still working
for v15?

At the end, I need to replace schema1 with schema3 for each function
(because table and type are automatically update)

Any suggestions?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Marc Millas 2023-08-17 15:47:34 shared buffers
Previous Message Lorusso Domenico 2023-08-17 15:17:53 Re: Dynamically accessing columns from a row type in a trigger