diff --git a/expected/pgaudit.out b/expected/pgaudit.out
index f27c370..ad5ae4a 100644
--- a/expected/pgaudit.out
+++ b/expected/pgaudit.out
@@ -1460,6 +1460,64 @@ NOTICE:  AUDIT: SESSION,107,1,DDL,DROP TABLE,,,DROP TABLE fk_fk,<none>
 DROP TABLE fk_pk;
 NOTICE:  AUDIT: SESSION,108,1,DDL,DROP TABLE,,,DROP TABLE fk_pk,<none>
 --
+-- Test that FK checks made by the RI fast path are not logged against the
+-- statement.  Since PostgreSQL 19 the fast path checks permissions from the FK
+-- trigger, which runs after the statement's own check or, when the constraint
+-- is deferred, at COMMIT.  A top-level COMMIT runs with the stack empty, while
+-- one made by a procedure or DO block runs with the CALL or DO on top.
+CREATE TABLE ri_pk (id int PRIMARY KEY);
+NOTICE:  AUDIT: SESSION,109,1,DDL,CREATE TABLE,,,CREATE TABLE ri_pk (id int PRIMARY KEY),<none>
+CREATE TABLE ri_fk (id int REFERENCES ri_pk (id) DEFERRABLE);
+NOTICE:  AUDIT: SESSION,110,1,DDL,CREATE TABLE,,,CREATE TABLE ri_fk (id int REFERENCES ri_pk (id) DEFERRABLE),<none>
+INSERT INTO ri_pk VALUES (1), (2);
+NOTICE:  AUDIT: SESSION,111,1,WRITE,INSERT,TABLE,public.ri_pk,"INSERT INTO ri_pk VALUES (1), (2)",<none>
+INSERT INTO ri_fk VALUES (1);
+NOTICE:  AUDIT: SESSION,112,1,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (1),<none>
+BEGIN;
+SET CONSTRAINTS ALL DEFERRED;
+INSERT INTO ri_fk VALUES (2);
+NOTICE:  AUDIT: SESSION,113,1,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (2),<none>
+COMMIT;
+COPY ri_fk FROM stdin;
+NOTICE:  AUDIT: SESSION,114,1,WRITE,COPY,TABLE,public.ri_fk,COPY ri_fk FROM stdin,<none>
+CREATE PROCEDURE ri_proc() LANGUAGE plpgsql AS $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+	INSERT INTO ri_fk VALUES (2);
+END $$;
+NOTICE:  AUDIT: SESSION,115,1,DDL,CREATE PROCEDURE,,,"CREATE PROCEDURE ri_proc() LANGUAGE plpgsql AS $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+	INSERT INTO ri_fk VALUES (2);
+END $$",<none>
+CALL ri_proc();
+NOTICE:  AUDIT: SESSION,116,1,FUNCTION,EXECUTE,FUNCTION,public.ri_proc,CALL ri_proc(),<none>
+NOTICE:  AUDIT: SESSION,116,2,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (1),<none>
+NOTICE:  AUDIT: SESSION,116,3,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (2),<none>
+DO $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+END $$;
+NOTICE:  AUDIT: SESSION,117,1,FUNCTION,DO,,,"DO $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+END $$",<none>
+NOTICE:  AUDIT: SESSION,117,2,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (1),<none>
+DROP PROCEDURE ri_proc();
+NOTICE:  AUDIT: SESSION,118,1,DDL,DROP PROCEDURE,,,DROP PROCEDURE ri_proc(),<none>
+DROP TABLE ri_fk;
+NOTICE:  AUDIT: SESSION,119,1,DDL,DROP TABLE,,,DROP TABLE ri_fk,<none>
+DROP TABLE ri_pk;
+NOTICE:  AUDIT: SESSION,120,1,DDL,DROP TABLE,,,DROP TABLE ri_pk,<none>
+--
 -- Test rows retrived or affected by statements
 \connect - :current_user
 SET pgaudit.log = 'all';
@@ -2650,6 +2708,65 @@ NOTICE:  AUDIT: SESSION,150,1,DDL,DROP INDEX,,,DROP INDEX h_idx,<none>,0
 DROP TABLE h;
 NOTICE:  AUDIT: SESSION,151,1,DDL,DROP TABLE,,,DROP TABLE h,<none>,0
 --
+-- Test that FK checks made by the RI fast path are not logged against the
+-- statement.  Since PostgreSQL 19 the fast path checks permissions from the FK
+-- trigger, which runs after the statement's own check or, when the constraint
+-- is deferred, at SET CONSTRAINTS ... IMMEDIATE or COMMIT, including a COMMIT
+-- made by a procedure or DO block.
+CREATE TABLE ri_pk (id int PRIMARY KEY);
+NOTICE:  AUDIT: SESSION,152,1,DDL,CREATE TABLE,,,CREATE TABLE ri_pk (id int PRIMARY KEY),<none>,0
+CREATE TABLE ri_fk (id int REFERENCES ri_pk (id) DEFERRABLE);
+NOTICE:  AUDIT: SESSION,153,1,DDL,CREATE TABLE,,,CREATE TABLE ri_fk (id int REFERENCES ri_pk (id) DEFERRABLE),<none>,0
+INSERT INTO ri_pk VALUES (1), (2);
+NOTICE:  AUDIT: SESSION,154,1,WRITE,INSERT,TABLE,public.ri_pk,"INSERT INTO ri_pk VALUES (1), (2)",<none>,2
+INSERT INTO ri_fk VALUES (1), (2);
+NOTICE:  AUDIT: SESSION,155,1,WRITE,INSERT,TABLE,public.ri_fk,"INSERT INTO ri_fk VALUES (1), (2)",<none>,2
+BEGIN;
+SET CONSTRAINTS ALL DEFERRED;
+INSERT INTO ri_fk VALUES (1), (2);
+NOTICE:  AUDIT: SESSION,156,1,WRITE,INSERT,TABLE,public.ri_fk,"INSERT INTO ri_fk VALUES (1), (2)",<none>,2
+SET CONSTRAINTS ALL IMMEDIATE;
+COMMIT;
+COPY ri_fk FROM stdin;
+NOTICE:  AUDIT: SESSION,157,1,WRITE,COPY,TABLE,public.ri_fk,COPY ri_fk FROM stdin,<none>,2
+CREATE PROCEDURE ri_proc() LANGUAGE plpgsql AS $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+	INSERT INTO ri_fk VALUES (2);
+END $$;
+NOTICE:  AUDIT: SESSION,158,1,DDL,CREATE PROCEDURE,,,"CREATE PROCEDURE ri_proc() LANGUAGE plpgsql AS $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+	INSERT INTO ri_fk VALUES (2);
+END $$",<none>,0
+CALL ri_proc();
+NOTICE:  AUDIT: SESSION,159,1,FUNCTION,EXECUTE,FUNCTION,public.ri_proc,CALL ri_proc(),<none>,0
+NOTICE:  AUDIT: SESSION,159,2,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (1),<none>,1
+NOTICE:  AUDIT: SESSION,159,3,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (2),<none>,1
+DO $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+END $$;
+NOTICE:  AUDIT: SESSION,160,1,FUNCTION,DO,,,"DO $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+END $$",<none>,0
+NOTICE:  AUDIT: SESSION,160,2,WRITE,INSERT,TABLE,public.ri_fk,INSERT INTO ri_fk VALUES (1),<none>,1
+DROP PROCEDURE ri_proc();
+NOTICE:  AUDIT: SESSION,161,1,DDL,DROP PROCEDURE,,,DROP PROCEDURE ri_proc(),<none>,0
+DROP TABLE ri_fk;
+NOTICE:  AUDIT: SESSION,162,1,DDL,DROP TABLE,,,DROP TABLE ri_fk,<none>,0
+DROP TABLE ri_pk;
+NOTICE:  AUDIT: SESSION,163,1,DDL,DROP TABLE,,,DROP TABLE ri_pk,<none>,0
+--
 -- Change configuration of user 1 so that full statements are not logged
 \connect - :current_user
 ALTER ROLE regress_user1 RESET pgaudit.log_relation;
diff --git a/pgaudit.c b/pgaudit.c
index 60e508c..59a9c75 100644
--- a/pgaudit.c
+++ b/pgaudit.c
@@ -264,6 +264,7 @@ typedef struct
     List *rangeTabls;           /* Tables in query tracking rows */
     List *permInfos;            /* Permission info rows for each table involved
                                    in the query */
+    bool permsPending;          /* Next permission check is this event's own */
 } AuditEvent;
 
 /*
@@ -1485,6 +1486,7 @@ pgaudit_ExecutorStart_hook(QueryDesc *queryDesc, int eflags)
     {
         /* Push the audit event onto the stack */
         stackItem = stack_push();
+        stackItem->auditEvent.permsPending = true;
 
         /* Initialize command using queryDesc->operation */
         switch (queryDesc->operation)
@@ -1549,6 +1551,9 @@ pgaudit_ExecutorStart_hook(QueryDesc *queryDesc, int eflags)
      */
     if (stackItem)
     {
+        /* Checks made after ExecutorStart are not this event's own */
+        stackItem->auditEvent.permsPending = false;
+
         MemoryContextSetParent(stackItem->contextAudit,
                                queryDesc->estate->es_query_cxt);
 
@@ -1566,6 +1571,25 @@ pgaudit_ExecutorCheckPerms_hook(List *rangeTabls,
                                 List *permInfos,
                                 bool ereport_on_violation)
 {
+    /*
+     * Only audit the top stack item's own check, i.e. the first one made by its
+     * ExecutorStart or by COPY.  Consume it even when not auditing so a later
+     * check cannot be mistaken for it.
+     *
+     * Any other check runs on behalf of something other than the statement on
+     * top of the stack, so auditing it would attribute the relations to that
+     * statement, or fail when the stack is empty.  Since PostgreSQL 19 the RI
+     * fast path checks from FK triggers, which may fire after the statement's
+     * own check or be deferred to COMMIT.  RI_Initial_Check() also checks while
+     * the utility command's stack item is on top.  The queries these go on to
+     * run, if any, are audited normally.
+     */
+    bool ownCheck = auditEventStack != NULL &&
+                    auditEventStack->auditEvent.permsPending;
+
+    if (ownCheck)
+        auditEventStack->auditEvent.permsPending = false;
+
     /*
      * Only do audit work when an executor-driven class is enabled or object
      * auditing via pgaudit.role might apply.  This short-circuits the role
@@ -1575,13 +1599,9 @@ pgaudit_ExecutorCheckPerms_hook(List *rangeTabls,
      * Also skip checks that are not enforcing.  A caller passing
      * ereport_on_violation false is asking whether it may proceed, not
      * executing a statement against the relations, so there is nothing to
-     * audit.  RI_Initial_Check() does this to decide whether it can validate a
-     * foreign key with a single query, and it runs while the utility command's
-     * own stack item is on top of the stack, so auditing the check would
-     * attribute the referenced relations to that command.  The validation query
-     * it goes on to run is audited normally.
+     * audit.
      */
-    if (audit_executor_enabled() && ereport_on_violation &&
+    if (ownCheck && audit_executor_enabled() && ereport_on_violation &&
         !IsAbortedTransactionBlockState() && !IsParallelWorker())
     {
         /* Get the audit oid if the role exists */
@@ -1591,7 +1611,7 @@ pgaudit_ExecutorCheckPerms_hook(List *rangeTabls,
         if (auditOid != InvalidOid || auditLogBitmap != 0)
         {
             /* If auditLogRows is on, wait for rows processed to be set */
-            if (auditLogRows && auditEventStack != NULL)
+            if (auditLogRows)
             {
                 /* Check if the top item is SELECT/INSERT for CREATE TABLE AS */
                 if (auditEventStack->auditEvent.commandTag == T_SelectStmt &&
@@ -1618,10 +1638,7 @@ pgaudit_ExecutorCheckPerms_hook(List *rangeTabls,
                 }
             }
             else
-            {
-                STACK_NOT_EMPTY();
                 log_select_dml(auditOid, rangeTabls, permInfos);
-            }
         }
     }
 
@@ -1745,6 +1762,8 @@ pgaudit_ProcessUtility_hook(PlannedStmt *pstmt,
         stackItem->auditEvent.logStmtLevel = GetCommandLogLevel(pstmt->utilityStmt);
         stackItem->auditEvent.commandTag = nodeTag(pstmt->utilityStmt);
         stackItem->auditEvent.command = CreateCommandTag(pstmt->utilityStmt);
+        stackItem->auditEvent.permsPending =
+            stackItem->auditEvent.commandTag == T_CopyStmt;
         command_text_set(&stackItem->auditEvent, queryString,
                          pstmt->stmt_location, pstmt->stmt_len);
 
diff --git a/sql/pgaudit.sql b/sql/pgaudit.sql
index cd496cf..3b9f6e4 100644
--- a/sql/pgaudit.sql
+++ b/sql/pgaudit.sql
@@ -994,6 +994,50 @@ ALTER TABLE fk_fk VALIDATE CONSTRAINT fk_fk_id_fkey_nv;
 DROP TABLE fk_fk;
 DROP TABLE fk_pk;
 
+--
+-- Test that FK checks made by the RI fast path are not logged against the
+-- statement.  Since PostgreSQL 19 the fast path checks permissions from the FK
+-- trigger, which runs after the statement's own check or, when the constraint
+-- is deferred, at COMMIT.  A top-level COMMIT runs with the stack empty, while
+-- one made by a procedure or DO block runs with the CALL or DO on top.
+CREATE TABLE ri_pk (id int PRIMARY KEY);
+CREATE TABLE ri_fk (id int REFERENCES ri_pk (id) DEFERRABLE);
+INSERT INTO ri_pk VALUES (1), (2);
+
+INSERT INTO ri_fk VALUES (1);
+
+BEGIN;
+SET CONSTRAINTS ALL DEFERRED;
+INSERT INTO ri_fk VALUES (2);
+COMMIT;
+
+COPY ri_fk FROM stdin;
+1
+2
+\.
+
+CREATE PROCEDURE ri_proc() LANGUAGE plpgsql AS $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+	INSERT INTO ri_fk VALUES (2);
+END $$;
+
+CALL ri_proc();
+
+DO $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+END $$;
+
+DROP PROCEDURE ri_proc();
+
+DROP TABLE ri_fk;
+DROP TABLE ri_pk;
+
 --
 -- Test rows retrived or affected by statements
 \connect - :current_user
@@ -1659,6 +1703,51 @@ CREATE INDEX h_idx ON h (x);
 DROP INDEX h_idx;
 DROP TABLE h;
 
+--
+-- Test that FK checks made by the RI fast path are not logged against the
+-- statement.  Since PostgreSQL 19 the fast path checks permissions from the FK
+-- trigger, which runs after the statement's own check or, when the constraint
+-- is deferred, at SET CONSTRAINTS ... IMMEDIATE or COMMIT, including a COMMIT
+-- made by a procedure or DO block.
+CREATE TABLE ri_pk (id int PRIMARY KEY);
+CREATE TABLE ri_fk (id int REFERENCES ri_pk (id) DEFERRABLE);
+INSERT INTO ri_pk VALUES (1), (2);
+
+INSERT INTO ri_fk VALUES (1), (2);
+
+BEGIN;
+SET CONSTRAINTS ALL DEFERRED;
+INSERT INTO ri_fk VALUES (1), (2);
+SET CONSTRAINTS ALL IMMEDIATE;
+COMMIT;
+
+COPY ri_fk FROM stdin;
+1
+2
+\.
+
+CREATE PROCEDURE ri_proc() LANGUAGE plpgsql AS $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+	INSERT INTO ri_fk VALUES (2);
+END $$;
+
+CALL ri_proc();
+
+DO $$
+BEGIN
+	SET CONSTRAINTS ALL DEFERRED;
+	INSERT INTO ri_fk VALUES (1);
+	COMMIT;
+END $$;
+
+DROP PROCEDURE ri_proc();
+
+DROP TABLE ri_fk;
+DROP TABLE ri_pk;
+
 --
 -- Change configuration of user 1 so that full statements are not logged
 \connect - :current_user
