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
Following scripts will take care to change schema owner
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.
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.