From 8b3db2e7a3084f1a9af2974ce113e11c3f976047 Mon Sep 17 00:00:00 2001 From: Bobbie Soedirgo <31685197+soedirgo@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:56:24 +0800 Subject: [PATCH] fix: pgmq ownership (#1362) * fix: pgmq ownership * tmp * bump version for production release --------- Co-authored-by: Oliver Rice --- .../pgmq/after-create.sql | 19 +++++++++++++++++++ common-nix.vars.pkr.hcl | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql diff --git a/ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql b/ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql new file mode 100644 index 000000000..8b126d403 --- /dev/null +++ b/ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql @@ -0,0 +1,19 @@ +do $$ +declare + extoid oid := (select oid from pg_extension where extname = 'pgmq'); + r record; +begin + set local search_path = ''; + update pg_extension set extowner = 'postgres'::regrole where extname = 'pgmq'; + for r in (select * from pg_depend where refobjid = extoid) loop + if r.classid = 'pg_type'::regclass then + execute(format('alter type %s owner to postgres;', r.objid::regtype)); + elsif r.classid = 'pg_proc'::regclass then + execute(format('alter function %s(%s) owner to postgres;', r.objid::regproc, pg_get_function_identity_arguments(r.objid))); + elsif r.classid = 'pg_class'::regclass then + execute(format('alter table %s owner to postgres;', r.objid::regclass)); + else + raise exception 'error on pgmq after-create script: unexpected object type %', r.classid; + end if; + end loop; +end $$; diff --git a/common-nix.vars.pkr.hcl b/common-nix.vars.pkr.hcl index fa25f1104..587e717cd 100644 --- a/common-nix.vars.pkr.hcl +++ b/common-nix.vars.pkr.hcl @@ -1 +1 @@ -postgres-version = "15.6.1.145" +postgres-version = "15.6.1.146"