Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
soedirgo committed Jan 17, 2024
1 parent 2882ef4 commit 04c86bd
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions nix/withTmpDb.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ options="-F -c listen_addresses=\"\" -k $PGDATA -c shared_preload_libraries=\"pg

reserved_roles="supabase_storage_admin, anon, reserved_but_not_yet_created, authenticator*"
reserved_memberships="pg_read_server_files, pg_write_server_files, pg_execute_server_program, role_with_reserved_membership"
privileged_extensions="hstore, postgres_fdw, pg_tle"
privileged_extensions="hstore, postgres_fdw, pg_tle, autoinc, citext"
privileged_extensions_custom_scripts_path="$tmpdir/privileged_extensions_custom_scripts"
privileged_role="privileged_role"
privileged_role_allowed_configs="session_replication_role, pgrst.*, other.nested.*"
Expand All @@ -27,7 +27,6 @@ cexts_option='-c supautils.constrained_extensions="{\"adminpack\": { \"cpu\": 64

pg_ctl start -o "$options" -o "$reserved_stuff_options" -o "$placeholder_stuff_options" -o "$cexts_option"

mkdir -p "$tmpdir/privileged_extensions_custom_scripts/hstore"
echo "do \$\$
begin
if not exists (select from pg_extension where extname = 'pg_tle') then
Expand All @@ -37,8 +36,16 @@ echo "do \$\$
raise notice 'extname: %, extschema: %, extversion: %, extcascade: %', @extname@, @extschema@, @extversion@, @extcascade@;
end if;
end \$\$;" > "$tmpdir/privileged_extensions_custom_scripts/before-create.sql"
echo 'create table t1();' > "$tmpdir/privileged_extensions_custom_scripts/hstore/before-create.sql"
echo 'drop table t1; create table t2 as values (1);' > "$tmpdir/privileged_extensions_custom_scripts/hstore/after-create.sql"

mkdir -p "$tmpdir/privileged_extensions_custom_scripts/autoinc"
echo 'create extension citext;' > "$tmpdir/privileged_extensions_custom_scripts/autoinc/after-create.sql"

mkdir -p "$tmpdir/privileged_extensions_custom_scripts/citext"
echo 'create table citext_has_been_created();' > "$tmpdir/privileged_extensions_custom_scripts/citext/after-create.sql"

mkdir -p "$tmpdir/privileged_extensions_custom_scripts/hstore"
echo 'create table hstore_before_create_script_has_been_run();' > "$tmpdir/privileged_extensions_custom_scripts/hstore/before-create.sql"
echo 'drop table hstore_before_create_script_has_been_run; create table hstore_after_create_script_has_been_run as values (1);' > "$tmpdir/privileged_extensions_custom_scripts/hstore/after-create.sql"

createdb contrib_regression

Expand Down

0 comments on commit 04c86bd

Please sign in to comment.