Skip to content

test: pgmq functions' owner modification #1537

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion nix/tests/expected/pgmq.out
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ select
msg_id,
read_ct,
message
from
from
pgmq.pop('Foo');
msg_id | read_ct | message
--------+---------+---------
Expand Down Expand Up @@ -139,3 +139,52 @@ CONTEXT: PL/pgSQL function pgmq.format_table_name(text,text) line 5 at RAISE
PL/pgSQL function pgmq.create_non_partitioned(text) line 3 during statement block local variable initialization
SQL statement "SELECT pgmq.create_non_partitioned(queue_name)"
PL/pgSQL function pgmq."create"(text) line 3 at PERFORM
\echo

-- pgmq schema functions with owners (ownership is modified on ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql)
select
n.nspname as schema_name,
p.proname as function_name,
r.rolname as owner
from
pg_proc p
join
pg_namespace n on p.pronamespace = n.oid
join
pg_roles r on p.proowner = r.oid
where
n.nspname = 'pgmq'
order by
p.proname;
schema_name | function_name | owner
-------------+-------------------------------+----------
pgmq | _belongs_to_pgmq | postgres
pgmq | _ensure_pg_partman_installed | postgres
pgmq | _get_partition_col | postgres
pgmq | _get_pg_partman_major_version | postgres
pgmq | _get_pg_partman_schema | postgres
pgmq | archive | postgres
pgmq | archive | postgres
pgmq | convert_archive_partitioned | postgres
pgmq | create | postgres
pgmq | create_non_partitioned | postgres
pgmq | create_partitioned | postgres
pgmq | create_unlogged | postgres
pgmq | delete | postgres
pgmq | delete | postgres
pgmq | detach_archive | postgres
pgmq | drop_queue | postgres
pgmq | format_table_name | postgres
pgmq | list_queues | postgres
pgmq | metrics | postgres
pgmq | metrics_all | postgres
pgmq | pop | postgres
pgmq | purge_queue | postgres
pgmq | read | postgres
pgmq | read_with_poll | postgres
pgmq | send | postgres
pgmq | send_batch | postgres
pgmq | set_vt | postgres
pgmq | validate_queue_name | postgres
(28 rows)

21 changes: 17 additions & 4 deletions nix/tests/sql/pgmq.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ select
msg_id,
read_ct,
message
from
from
pgmq.pop('Foo');


Expand Down Expand Up @@ -84,7 +84,20 @@ select
select pgmq.create('F--oo');
select pgmq.create('F$oo');
select pgmq.create($$F'oo$$);
\echo




-- pgmq schema functions with owners (ownership is modified on ansible/files/postgresql_extension_custom_scripts/pgmq/after-create.sql)
select
n.nspname as schema_name,
p.proname as function_name,
r.rolname as owner
from
pg_proc p
join
pg_namespace n on p.pronamespace = n.oid
join
pg_roles r on p.proowner = r.oid
where
n.nspname = 'pgmq'
order by
p.proname;