File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
engine/internal/provision/databases/postgres Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -163,21 +163,30 @@ begin
163163 end loop;
164164 end loop;
165165
166- -- Functions,
166+ -- Functions and Procedures ,
167167 for r in
168168 select
169+ p.prokind,
169170 p.proname,
170171 n.nspname,
171172 pg_catalog.pg_get_function_identity_arguments(p.oid) as args
172173 from pg_catalog.pg_namespace as n
173174 join pg_catalog.pg_proc as p on p.pronamespace = n.oid
174175 where not n.nspname in ('pg_catalog', 'information_schema')
175176 and p.proname not ilike 'dblink%' -- We do not want dblink to be involved (exclusion)
177+ and p.prokind in ('f', 'p', 'a', 'w')
176178 loop
177179 raise debug 'Changing ownership of function %.%(%) to %',
178180 r.nspname, r.proname, r.args, new_owner;
179181 execute format(
180- 'alter function %I.%I(%s) owner to %I', -- todo: check support CamelStyle r.args
182+ 'alter %s %I.%I(%s) owner to %I', -- todo: check support CamelStyle r.args,
183+ case r.prokind
184+ when 'f' then 'function'
185+ when 'w' then 'function'
186+ when 'p' then 'procedure'
187+ when 'a' then 'aggregate'
188+ else 'unknown'
189+ end,
181190 r.nspname,
182191 r.proname,
183192 r.args,
You can’t perform that action at this time.
0 commit comments