aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-01-19 19:52:13 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2017-01-19 19:52:13 -0500
commitba61a04bc7fefeee03416d9911eb825c4897c223 (patch)
tree012e6abc4841574d0400842f1cb385ede4367389 /src
parentd479e37e3d20efad8b178e0f1e468c086a7519a8 (diff)
downloadpostgresql-ba61a04bc7fefeee03416d9911eb825c4897c223.tar.gz
postgresql-ba61a04bc7fefeee03416d9911eb825c4897c223.zip
Avoid core dump for empty prepared statement in an aborted transaction.
Brown-paper-bag bug in commit ab1f0c822: 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
Diffstat (limited to 'src')
-rw-r--r--src/backend/tcop/postgres.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index bb89cce8cb9..c15303c7bb4 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -1559,7 +1559,8 @@ exec_bind_message(StringInfo input_message)
* functions.
*/
if (IsAbortedTransactionBlockState() &&
- (!IsTransactionExitStmt(psrc->raw_parse_tree->stmt) ||
+ (!(psrc->raw_parse_tree &&
+ IsTransactionExitStmt(psrc->raw_parse_tree->stmt)) ||
numParams != 0))
ereport(ERROR,
(errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),