|
8 | 8 | * Portions Copyright (c) 1994, Regents of the University of California |
9 | 9 | * |
10 | 10 | * IDENTIFICATION |
11 | | - *$PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.12 2008/05/12 00:00:44 alvherre Exp $ |
| 11 | + *$PostgreSQL: pgsql/src/backend/access/gin/gininsert.c,v 1.13 2008/05/16 01:27:06 tgl Exp $ |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
14 | 14 |
|
@@ -246,7 +246,11 @@ ginBuildCallback(Relation index, HeapTuple htup, Datum *values, |
246 | 246 | uint32nlist; |
247 | 247 |
|
248 | 248 | while ((list=ginGetEntry(&buildstate->accum,&entry,&nlist))!=NULL) |
| 249 | +{ |
| 250 | +/* there could be many entries, so be willing to abort here */ |
| 251 | +CHECK_FOR_INTERRUPTS(); |
249 | 252 | ginEntryInsert(index,&buildstate->ginstate,entry,list,nlist, TRUE); |
| 253 | +} |
250 | 254 |
|
251 | 255 | MemoryContextReset(buildstate->tmpCtx); |
252 | 256 | ginInitBA(&buildstate->accum); |
@@ -331,9 +335,14 @@ ginbuild(PG_FUNCTION_ARGS) |
331 | 335 | reltuples=IndexBuildHeapScan(heap,index,indexInfo, |
332 | 336 | ginBuildCallback, (void*)&buildstate); |
333 | 337 |
|
| 338 | +/* dump remaining entries to the index */ |
334 | 339 | oldCtx=MemoryContextSwitchTo(buildstate.tmpCtx); |
335 | 340 | while ((list=ginGetEntry(&buildstate.accum,&entry,&nlist))!=NULL) |
| 341 | +{ |
| 342 | +/* there could be many entries, so be willing to abort here */ |
| 343 | +CHECK_FOR_INTERRUPTS(); |
336 | 344 | ginEntryInsert(index,&buildstate.ginstate,entry,list,nlist, TRUE); |
| 345 | +} |
337 | 346 | MemoryContextSwitchTo(oldCtx); |
338 | 347 |
|
339 | 348 | MemoryContextDelete(buildstate.tmpCtx); |
|