Hi, The Assert(buffer != NULL) is placed after the buffer is accessed, which could lead to a segmentation fault before the check is executed.
Attached a small patch to correct that. -- Regards, Amul Sul EDB: http://www.enterprisedb.com
diff --git a/src/backend/commands/copyfrom.c b/src/backend/commands/copyfrom.c index ca85270be6d..2d3462913e1 100644 --- a/src/backend/commands/copyfrom.c +++ b/src/backend/commands/copyfrom.c @@ -597,10 +597,12 @@ CopyMultiInsertInfoNextFreeSlot(CopyMultiInsertInfo *miinfo, ResultRelInfo *rri) { CopyMultiInsertBuffer *buffer = rri->ri_CopyMultiInsertBuffer; - int nused = buffer->nused; + int nused; Assert(buffer != NULL); - Assert(nused < MAX_BUFFERED_TUPLES); + Assert(buffer->nused < MAX_BUFFERED_TUPLES); + + nused = buffer->nused; if (buffer->slots[nused] == NULL) buffer->slots[nused] = table_slot_create(rri->ri_RelationDesc, NULL);