Intelligence, Advanced Charting & Trading Platform
test(db): inspect grants without trying to resolve PUBLIC as a login role
davoodmehraban89 committed
Oct 22, 2026 at 23:14 UTC
b54d26205b68cae8e92d5eb0ec0606f9224faada
1 file changed
+5
-3
db/tests/notification_outbox_invariants.sql
+5
-3
@@ -148,9 +148,11 @@ BEGIN
148
IF dup = n THEN RAISE EXCEPTION 'user-scoped idempotency violated'; END IF;
149
150
-- SQL permissions do not grant anonymous read or execution.
151
- IF has_table_privilege('public','notification_outbox','SELECT')
152
- AND EXISTS(SELECT 1 FROM pg_roles WHERE rolname='public') THEN
153
- RAISE EXCEPTION 'unexpected public table privilege';
151
+ IF EXISTS (
152
+ SELECT 1 FROM information_schema.role_table_grants
153
+ WHERE grantee='PUBLIC' AND table_name='notification_outbox'
154
+ ) THEN
155
+ RAISE EXCEPTION 'unexpected PUBLIC table privilege';
156
END IF;
157
END $$;
158