Summary
pgaudit's ExecutorCheckPerms_hook handler (log_select_dml) assumes auditEventStack is non-NULL. That stack is only established during executor startup, so when ExecCheckRTPerms() is called outside a running executor, the hook fires with auditEventStack == NULL and dereferences it → SIGSEGV in pgaudit.c.
How it's hit
An extension that performs table permission checks at plan time or from a utility command (before ExecutorStart builds the audit stack) triggers this whenever pgaudit is loaded. pg_duckdb (preview) calls ExecCheckRTPerms() from its planner and utility/COPY handling, so with pgaudit preloaded the backend crashes.
Ask
Add a NULL-auditEventStack guard in pgaudit's ExecutorCheckPerms_hook path so it safely no-ops when there is no active audit event stack.
Follow-on cleanup
Once hardened, pg_duckdb can delete its YbExecCheckRTPerms workaround (which temporarily clears ExecutorCheckPerms_hook) and call ExecCheckRTPerms() directly. Pre-GA item for pg_duckdb.
automated · Claude Code (Opus 4.8)
Summary
pgaudit's
ExecutorCheckPerms_hookhandler (log_select_dml) assumesauditEventStackis non-NULL. That stack is only established during executor startup, so whenExecCheckRTPerms()is called outside a running executor, the hook fires withauditEventStack == NULLand dereferences it → SIGSEGV inpgaudit.c.How it's hit
An extension that performs table permission checks at plan time or from a utility command (before
ExecutorStartbuilds the audit stack) triggers this whenever pgaudit is loaded. pg_duckdb (preview) callsExecCheckRTPerms()from its planner and utility/COPY handling, so with pgaudit preloaded the backend crashes.Ask
Add a NULL-
auditEventStackguard in pgaudit'sExecutorCheckPerms_hookpath so it safely no-ops when there is no active audit event stack.Follow-on cleanup
Once hardened, pg_duckdb can delete its
YbExecCheckRTPermsworkaround (which temporarily clearsExecutorCheckPerms_hook) and callExecCheckRTPerms()directly. Pre-GA item for pg_duckdb.automated · Claude Code (Opus 4.8)