Commit ba61a04b authored by Tom Lane's avatar Tom Lane

Avoid core dump for empty prepared statement in an aborted transaction.

Brown-paper-bag bug in commit ab1f0c82: the old code here coped with
null CachedPlanSource.raw_parse_tree, the new code not so much.
Per report from Dave Cramer.

No regression test, because our core testing infrastructure doesn't
provide any easy way to exercise this path.  Fortunately, the JDBC
crew test it regularly.

Discussion: https://postgr.es/m/CADK3HH+Ug3xCysKqw_dZOnaNnytZ1Rh5yP05hjO-e4NoyRxVvA@mail.gmail.com
parent d479e37e
...@@ -1559,7 +1559,8 @@ exec_bind_message(StringInfo input_message) ...@@ -1559,7 +1559,8 @@ exec_bind_message(StringInfo input_message)
* functions. * functions.
*/ */
if (IsAbortedTransactionBlockState() && if (IsAbortedTransactionBlockState() &&
(!IsTransactionExitStmt(psrc->raw_parse_tree->stmt) || (!(psrc->raw_parse_tree &&
IsTransactionExitStmt(psrc->raw_parse_tree->stmt)) ||
numParams != 0)) numParams != 0))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION), (errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment