Fix BUG #2594: Gin Indexes cause server to crash when it builds on empty table
authorTeodor Sigaev <teodor@sigaev.ru>
Tue, 29 Aug 2006 14:05:44 +0000 (14:05 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Tue, 29 Aug 2006 14:05:44 +0000 (14:05 +0000)
src/backend/access/gin/ginbulk.c

index c614b624c3a98506df93a6fd0ce94990a0e84c1c..5bcd91af1412b0ae4abaf3e1141d4b7e647c00b5 100644 (file)
@@ -8,7 +8,7 @@
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *          $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.4 2006/07/16 00:54:22 tgl Exp $
+ *          $PostgreSQL: pgsql/src/backend/access/gin/ginbulk.c,v 1.5 2006/08/29 14:05:44 teodor Exp $
  *-------------------------------------------------------------------------
  */
 
@@ -245,6 +245,9 @@ ginGetEntry(BuildAccumulator *accum, Datum *value, uint32 *n) {
        accum->stack = palloc0(sizeof(EntryAccumulator*)*(accum->maxdepth+1));
        entry = accum->entries;
 
+       if ( entry == NULL )
+           return NULL;
+
        /* find most-left value */
        for(;;) {
            accum->stack[ accum->stackpos ] = entry;