Skip to content

test: output default event triggers #1504

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 2 commits into from
Apr 1, 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
6 changes: 3 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -845,9 +845,6 @@
exit 1
fi

echo "Running migrations tests"
pg_prove -p 5435 -U supabase_admin -h localhost -d postgres -v ${./migrations/tests}/test.sql

mkdir -p $out/regression_output
if ! pg_regress \
--use-existing \
Expand All @@ -863,6 +860,9 @@
exit 1
fi

echo "Running migrations tests"
pg_prove -p 5435 -U supabase_admin -h localhost -d postgres -v ${./migrations/tests}/test.sql

# Copy logs to output
for logfile in $(find /tmp -name postgresql.log -type f); do
cp "$logfile" $out/postgresql.log
Expand Down
25 changes: 25 additions & 0 deletions nix/tests/expected/evtrigs.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
SELECT
e.evtname,
e.evtowner::regrole AS evtowner,
e.evtfoid::regproc AS evtfunction,
p.proowner::regrole AS function_owner
FROM pg_event_trigger e
JOIN pg_proc p
ON e.evtfoid = p.oid
WHERE p.prorettype = 'event_trigger'::regtype;
evtname | evtowner | evtfunction | function_owner
----------------------------------------+----------------+------------------------------------+----------------
issue_pg_net_access | postgres | grant_pg_net_access | postgres
issue_pg_graphql_access | supabase_admin | grant_pg_graphql_access | supabase_admin
issue_graphql_placeholder | supabase_admin | set_graphql_placeholder | supabase_admin
pgrst_ddl_watch | supabase_admin | pgrst_ddl_watch | supabase_admin
pgrst_drop_watch | supabase_admin | pgrst_drop_watch | supabase_admin
graphql_watch_ddl | supabase_admin | graphql.increment_schema_version | supabase_admin
graphql_watch_drop | supabase_admin | graphql.increment_schema_version | supabase_admin
issue_pg_cron_access | supabase_admin | grant_pg_cron_access | postgres
pg_tle_event_trigger_for_drop_function | supabase_admin | pgtle.pg_tle_feature_info_sql_drop | supabase_admin
pgaudit_ddl_command_end | supabase_admin | pgaudit_ddl_command_end | supabase_admin
pgaudit_sql_drop | supabase_admin | pgaudit_sql_drop | supabase_admin
pgsodium_trg_mask_update | supabase_admin | pgsodium.trg_mask_update | supabase_admin
(12 rows)

9 changes: 9 additions & 0 deletions nix/tests/sql/evtrigs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
SELECT
e.evtname,
e.evtowner::regrole AS evtowner,
e.evtfoid::regproc AS evtfunction,
p.proowner::regrole AS function_owner
FROM pg_event_trigger e
JOIN pg_proc p
ON e.evtfoid = p.oid
WHERE p.prorettype = 'event_trigger'::regtype;