]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_stat_statements: Set PlannedStmt to NULL after nested utility execution
authorMichael Paquier <michael@paquier.xyz>
Wed, 13 May 2026 06:39:44 +0000 (15:39 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 13 May 2026 06:39:44 +0000 (15:39 +0900)
commit66366217822e23a00251f6ba3743d8e5675fcfc2
tree8cefd29c4ccf16e9339d0335e9a59b5908c3400a
parent900c07b854a7d7549ea4116aaafbb02bc610553a
pg_stat_statements: Set PlannedStmt to NULL after nested utility execution

As mentioned in 8268e41aca23, pgss_ProcessUtility() may free the
PlannedStmt after an internal ROLLBACK.  This commit sets the
PlannedStmt "pstmt" to NULL once it is no longer safe to rely on it,
making bugs similar to the one fixed by the previous commit easier to
detect.

Suggested-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/0A9A8DAC-BC3C-4C7A-9504-2C6050405544@anarazel.de
contrib/pg_stat_statements/pg_stat_statements.c