logical decoding: beware of an unset specinsert change
authorAlvaro Herrera
Thu, 5 Jul 2018 21:42:37 +0000 (17:42 -0400)
committerAlvaro Herrera
Thu, 5 Jul 2018 21:42:37 +0000 (17:42 -0400)
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.

src/backend/replication/logical/reorderbuffer.c

index 8226a20ae08081530117bdeb51d450b6c32ec9c7..69ae504d78ceb984066c5f0e2cd1dc2e16dc1038 100644 (file)
@@ -1519,6 +1519,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;