Fix bug reported by Michael Fuhr on Sun, 23 Apr 2006 09:52:31 -0600

(pgsql-committers@postgresql.org).
This commit is contained in:
Tatsuo Ishii 2006-04-25 00:40:54 +00:00
parent b532c86f2e
commit a34fd95977

View File

@ -1,5 +1,5 @@
/*
* $PostgreSQL: pgsql/contrib/pgrowlocks/pgrowlocks.c,v 1.1 2006/04/23 01:12:58 ishii Exp $
* $PostgreSQL: pgsql/contrib/pgrowlocks/pgrowlocks.c,v 1.2 2006/04/25 00:40:54 ishii Exp $
*
* Copyright (c) 2005-2006 Tatsuo Ishii
*
@ -61,6 +61,7 @@ extern Datum pgrowlocks(PG_FUNCTION_ARGS);
#undef MAKERANGEVARFROMNAMELIST_HAS_TWO_ARGS
typedef struct {
Relation rel;
HeapScanDesc scan;
int ncolumns;
} MyData;
@ -100,6 +101,7 @@ pgrowlocks(PG_FUNCTION_ARGS)
rel = heap_openrv(relrv, AccessShareLock);
scan = heap_beginscan(rel, SnapshotNow, 0, NULL);
mydata = palloc(sizeof(*mydata));
mydata->rel = rel;
mydata->scan = scan;
mydata->ncolumns = tupdesc->natts;
funcctx->user_fctx = mydata;
@ -222,7 +224,7 @@ pgrowlocks(PG_FUNCTION_ARGS)
}
heap_endscan(scan);
heap_close(scan->rs_rd, AccessShareLock);
heap_close(mydata->rel, AccessShareLock);
SRF_RETURN_DONE(funcctx);
}