]> granicus.if.org Git - postgresql/commitdiff
logical decoding: beware of an unset specinsert change
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Thu, 5 Jul 2018 21:42:37 +0000 (17:42 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
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 5792cd14a09fc545c4438e77202aad35d2f38574..d3ec13705104f6fd8235449ef4f845a32142d0fe 100644 (file)
@@ -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;