Skip to content

Commit cea7ab6

Browse files
committed
test: custom scripts for extensions not in privileged_extensions
1 parent 5d33f9e commit cea7ab6

File tree

5 files changed

+20
-2
lines changed

5 files changed

+20
-2
lines changed

test/expected/extension_custom_scripts.out

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ set role extensions_role;
22
\echo
33

44
-- per-extension custom scripts are run
5+
drop extension if exists citext;
6+
NOTICE: extension "citext" does not exist, skipping
7+
create extension autoinc;
8+
drop extension citext;
9+
drop extension autoinc;
10+
\echo
11+
12+
-- per-extension custom scripts are run for extensions not in privileged_extensions
513
create extension fuzzystrmatch;
614
drop extension fuzzystrmatch;
715
select * from t2;

test/init.conf.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ wal_level=logical
66

77
supautils.reserved_roles='supabase_storage_admin, anon, reserved_but_not_yet_created, authenticator*'
88
supautils.reserved_memberships='pg_read_server_files,pg_write_server_files,pg_execute_server_program,role_with_reserved_membership'
9-
supautils.privileged_extensions='autoinc, citext, hstore, sslinfo, insert_username, dict_xsyn, fuzzystrmatch, postgres_fdw, pageinspect'
9+
supautils.privileged_extensions='autoinc, citext, hstore, sslinfo, insert_username, dict_xsyn, postgres_fdw, pageinspect'
1010
supautils.constrained_extensions='{"adminpack": { "cpu": 64}, "cube": { "mem": "17 GB"}, "lo": { "disk": "100 GB"}, "amcheck": { "cpu": 2, "mem": "100 MB", "disk": "100 MB"}}'
1111
supautils.privileged_role='privileged_role'
1212
supautils.privileged_role_allowed_configs='session_replication_role, pgrst.*, other.nested.*'

test/init.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env sh
2+
13
# print notice when creating an extension
24
mkdir -p "$TMPDIR/extension-custom-scripts"
35
echo "do \$\$

test/init.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ grant all on database postgres to privileged_role;
2222

2323
-- non-superuser extensions role
2424
create role extensions_role login nosuperuser;
25-
grant all on database postgres to extensions_role;
25+
grant all on database contrib_regression, postgres to extensions_role;
2626
alter default privileges for role postgres in schema public grant all on tables to extensions_role;
2727

2828
-- non-superuser that should be unaffected by extension logic when creating db objects

test/sql/extension_custom_scripts.sql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@ set role extensions_role;
22
\echo
33

44
-- per-extension custom scripts are run
5+
drop extension if exists citext;
6+
create extension autoinc;
7+
8+
drop extension citext;
9+
drop extension autoinc;
10+
\echo
11+
12+
-- per-extension custom scripts are run for extensions not in privileged_extensions
513
create extension fuzzystrmatch;
614
drop extension fuzzystrmatch;
715
select * from t2;

0 commit comments

Comments
 (0)