pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Lorusso Domenico <domenico.l76@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Schema renaming cascade
Date: Thu, 17 Aug 2023 17:54:45 +0200
Message-ID: <20230817155445.lr33wx2eupzu2eqf@alvherre.pgsql> (raw)
In-Reply-To: <CAJMpnG6Ai7tfBCQ+XiA1d3UFc=fpD5f0tCFgu49O2orfuawCzw@mail.gmail.com>

On 2023-Aug-17, Lorusso Domenico wrote:

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

Maybe you should consider removing schema name references in function
source code, and instead refer to the tables (and other functions, etc)
by their unqualified names, and at the same time attach a "SET
search_path" clause to the function.  That way, when you need to rename
the schema you don't need to change the function source code, just
update its "SET search_path" clause.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





view thread (2+ messages)

Message-ID: <20230817155445.lr33wx2eupzu2eqf@alvherre.pgsql>
Permalink:  ../20230817155445.lr33wx2eupzu2eqf@alvherre.pgsql/
Also on:    postgresql.org/message-id/20230817155445.lr33wx2eupzu2eqf@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: alvherre@alvh.no-ip.org, domenico.l76@gmail.com
  Subject: Re: Schema renaming cascade
  In-Reply-To: <20230817155445.lr33wx2eupzu2eqf@alvherre.pgsql>
  References: <CAJMpnG6Ai7tfBCQ+XiA1d3UFc=fpD5f0tCFgu49O2orfuawCzw@mail.gmail.com> <20230817155445.lr33wx2eupzu2eqf@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox