---
title: "PostgreSQL Event Triggers without superuser access"
description: "Supabase's supautils extension lets non-superusers create Postgres Event Triggers by intercepting `create event trigger` from a \"privileged role\" via ProcessUtility_hook, temporarily elevating to superuser for creation, then assigning ownership back to the privileged role."
url: "https://swe.quest/articles/postgresql-event-triggers-without-superuser-access-1e29cc1decfb7891"
canonical: "https://supabase.com/blog/event-triggers-wo-superuser"
source: "Supabase"
published: "2025-05-08"
difficulty: "hard"
kind: "Deep dive"
reading_minutes: 3
tags: ["postgres","security","identity-auth"]
---

# PostgreSQL Event Triggers without superuser access

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2025-05-08, 3 min read, Deep dive. Original: [https://supabase.com/blog/event-triggers-wo-superuser](https://supabase.com/blog/event-triggers-wo-superuser)

## Summary

Supabase's supautils extension lets non-superusers create Postgres Event Triggers by intercepting \`create event trigger\` from a "privileged role" via ProcessUtility\_hook, temporarily elevating to superuser for creation, then assigning ownership back to the privileged role. Because event triggers fire for every role with the invoking role's privileges, this alone would allow privilege escalation, such as a trigger that runs \`alter role ... superuser\` when a superuser executes DDL. To prevent that, the extension uses fmgr\_hook to replace user event trigger functions with a no-op (\`version()\`) whenever a superuser or reserved role is executing. The feature is live for new Supabase projects, and upstream patches proposing more restricted user event triggers in Postgres core are under discussion.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Security](https://swe.quest/tags/security.md) (Security)
- [Identity & auth](https://swe.quest/tags/identity-auth.md) (Security)

## Prerequisites

- PostgreSQL roles and privileges ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- Postgres event triggers ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- Postgres extension hooks ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))

## Keywords

supautils, PostgreSQL, Event Triggers, ProcessUtility\_hook, fmgr\_hook, Supabase

## Related posts

- [Protecting reserved roles with PostgreSQL Hooks](https://swe.quest/articles/protecting-reserved-roles-with-postgresql-hooks-2e21a72630349824.md): Supabase · 2021-07-02 · Hard · 10 min read · PostgreSQL, Identity & auth, C & C++, Multi-tenancy
  Supabase grants customers the CREATEROLE privilege while preventing them from altering or dropping its internal service roles (like supabase\_storage\_admin) via a C extension, SupaUtils, that hooks PostgreSQL's ProcessUtility\_hook.
- [Postgres Event Triggers Are Now Supported in Neon](https://swe.quest/articles/postgres-event-triggers-are-now-supported-in-neon-6c294c5befac4572.md): Neon · 2025-07-03 · Medium · 3 min read · PostgreSQL, Schema migrations
  Neon now supports Postgres event triggers through the neon\_superuser role, and they behave exactly as in vanilla Postgres.
- [Supabase Auth: Identity Linking, Hooks, and HaveIBeenPwned integration](https://swe.quest/articles/supabase-auth-identity-linking-hooks-and-haveibeenpwned-integration-8ed59b21ef27e3e6.md): Supabase · 2023-12-14 · Medium · 5 min read · Identity & auth, PostgreSQL
  Supabase Auth adds four features: manual Identity Linking via linkIdentity()/unlinkIdentity() for OAuth identities, session controls (time-boxed sessions, inactivity timeouts, single session per user on Pro and above), leaked password protection using the HaveIBeenPwned Pwned Passwords API with configurable password requirements, and Auth Hooks.
- [Supabase Security Retro: 2025](https://swe.quest/articles/supabase-security-retro-2025-91f5c4e25d9fa3d9.md): Supabase · 2026-01-07 · Easy · 7 min read · PostgreSQL, Security, Identity & auth
  Supabase's 2025 security work centered on safer defaults around Postgres Row Level Security and API exposure.
- [Postgres Roles and Privileges](https://swe.quest/articles/postgres-roles-and-privileges-34a9d5f1c1427204.md): Supabase · 2024-04-11 · Medium · 20 min read · PostgreSQL, Identity & auth, Security
  Postgres access control rests on objects, privileges, roles and ownership: an object's owner holds all privileges on it and is the one who can grant them, so even an admin-like role such as Supabase's non-superuser postgres gets permission denied when granting on a table it neither owns nor holds privileges on.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
