Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJfUO-0068Y9-5m for pgsql-admin@arkaria.postgresql.org; Tue, 18 Jun 2024 20:31:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sJfUL-002n5D-Ox for pgsql-admin@arkaria.postgresql.org; Tue, 18 Jun 2024 20:31:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJfUL-002n54-Bj for pgsql-admin@lists.postgresql.org; Tue, 18 Jun 2024 20:31:34 +0000 Received: from chi208.greengeeks.net ([65.60.38.74]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sJfUJ-002LHu-LT for pgsql-admin@lists.postgresql.org; Tue, 18 Jun 2024 20:31:33 +0000 Received: from [217.180.196.83] (port=60712 helo=Incisivetech) by chi208.greengeeks.net with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1sJfUM-0000000F8cZ-18Qy; Tue, 18 Jun 2024 20:31:29 +0000 From: To: "'David G. Johnston'" Cc: "'PABLO ANDRES IBARRA DUPRAT'" , References: <001401dac1b9$edd4aea0$c97e0be0$@incisivetechgroup.com> In-Reply-To: Subject: RE: Scripting a ALTER PROCEDURE or FUNCTION to Change OWNER Date: Tue, 18 Jun 2024 16:31:27 -0400 Message-ID: <002f01dac1be$7fab9830$7f02c890$@incisivetechgroup.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0030_01DAC19C.F89A4650" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJpDEmwwkSiKZv+nXQ7OW7oTtLkIALOkXdUATBc/5sC3G3fbwG9ZPhosGyeR3A= Content-Language: en-us X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - chi208.greengeeks.net X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - incisivetechgroup.com X-Get-Message-Sender-Via: chi208.greengeeks.net: authenticated_id: lennam@incisivetechgroup.com X-Authenticated-Sender: chi208.greengeeks.net: lennam@incisivetechgroup.com X-Source: X-Source-Args: X-Source-Dir: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multipart message in MIME format. ------=_NextPart_000_0030_01DAC19C.F89A4650 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable I provided the scripts , use , how ever you like =20 =20 =20 From: David G. Johnston =20 Sent: Tuesday, June 18, 2024 4:23 PM To: lennam@incisivetechgroup.com Cc: PABLO ANDRES IBARRA DUPRAT ; = pgsql-admin@lists.postgresql.org Subject: Re: Scripting a ALTER PROCEDURE or FUNCTION to Change OWNER =20 On Tue, Jun 18, 2024 at 12:58=E2=80=AFPM > wrote: =20 Following scripts will take care to change schema owner=20 =20 Mk_altr_proc_owner.sql ( copy past this SQL statement) SELECT ' alter procedure '||rtrim(nspname)||'.'||ltrim( proname )||' = owner to targetschema;' =20 Maybe using quote_ident to prevent, unlikely as it may be, SQL injection = issues. The trims seem likely to be unnecessary - catalog contents = should be clean. =20 =20 Psql -h hostname -U ursename -d dbname -t -A -f mk_altr_proc_owner.sql = -o altr_proc_owner.sql =20 =20 The script output file is nice to check one's works I guess. But if you = are going to use psql there is the \gexec meta-command that makes this = even easier. =20 David J. =20 ------=_NextPart_000_0030_01DAC19C.F89A4650 Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable

I provided the scripts , use , = how ever you like

 

 

 

From: David G. Johnston = <david.g.johnston@gmail.com>
Sent: Tuesday, June 18, = 2024 4:23 PM
To: lennam@incisivetechgroup.com
Cc: = PABLO ANDRES IBARRA DUPRAT <Pablo.Ibarra@itau.cl>; = pgsql-admin@lists.postgresql.org
Subject: Re: Scripting a = ALTER PROCEDURE or FUNCTION to Change OWNER

 

On Tue, = Jun 18, 2024 at 12:58=E2=80=AFPM <lennam@incisivetechgroup.com= > wrote:

 <= /o:p>

Following = scripts will take care to change schema owner

 <= /o:p>

Mk_altr_proc= _owner.sql  ( copy past this SQL statement)

SELECT ' = alter procedure '||rtrim(nspname)||'.'||ltrim( proname )||' owner to = targetschema;'

 

Maybe = using quote_ident to prevent, unlikely as it may be, SQL injection = issues.  The trims seem likely to be unnecessary - catalog contents = should be clean.

 

  =

Psql -h = hostname -U ursename -d dbname -t -A -f mk_altr_proc_owner.sql -o = altr_proc_owner.sql

 <= /o:p>

 

The = script output file is nice to check one's works I guess.  But if = you are going to use psql there is the \gexec meta-command that makes = this even easier.

 

David = J.

 

------=_NextPart_000_0030_01DAC19C.F89A4650--