Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit fc3e538

Browse files
committed
Merge branch 'nik-fix-alter-stored-procedure' into 'master'
bugfix: Change permissions for stored procedures See merge request postgres-ai/database-lab!521
2 parents 42b6a52 + 03b8771 commit fc3e538

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

‎engine/internal/provision/databases/postgres/postgres_mgmt.go‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff 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,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /