From: Alvaro Herrera Date: Thu, 5 Jul 2018 21:42:37 +0000 (-0400) Subject: logical decoding: beware of an unset specinsert change X-Git-Tag: REL_12_BETA1~1927 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3ca966c06f91fb6ccc11d71d4094c1e297b8945d;p=postgresql logical decoding: beware of an unset specinsert change Coverity complains that there is no protection in the code (at least in non-assertion-enabled builds) against speculative insertion failing to follow the expected protocol. Add an elog(ERROR) for the case. --- diff --git a/src/backend/replication/logical/reorderbuffer.c b/src/backend/replication/logical/reorderbuffer.c index 5792cd14a0..d3ec137051 100644 --- a/src/backend/replication/logical/reorderbuffer.c +++ b/src/backend/replication/logical/reorderbuffer.c @@ -1474,6 +1474,8 @@ ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid, * use as a normal record. It'll be cleaned up at the end * of INSERT processing. */ + if (specinsert == NULL) + elog(ERROR, "invalid ordering of speculative insertion changes"); Assert(specinsert->data.tp.oldtuple == NULL); change = specinsert; change->action = REORDER_BUFFER_CHANGE_INSERT;