Skip to content

Commit a34fd95

Browse files
committed
Fix bug reported by Michael Fuhr on Sun, 23 Apr 2006 09:52:31 -0600
(pgsql-committers@postgresql.org).
1 parent b532c86 commit a34fd95

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

contrib/pgrowlocks/pgrowlocks.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* $PostgreSQL: pgsql/contrib/pgrowlocks/pgrowlocks.c,v 1.1 2006/04/23 01:12:58 ishii Exp $
2+
* $PostgreSQL: pgsql/contrib/pgrowlocks/pgrowlocks.c,v 1.2 2006/04/25 00:40:54 ishii Exp $
33
*
44
* Copyright (c) 2005-2006 Tatsuo Ishii
55
*
@@ -61,6 +61,7 @@ extern Datum pgrowlocks(PG_FUNCTION_ARGS);
6161
#undef MAKERANGEVARFROMNAMELIST_HAS_TWO_ARGS
6262

6363
typedef struct {
64+
Relation rel;
6465
HeapScanDesc scan;
6566
int ncolumns;
6667
} MyData;
@@ -100,6 +101,7 @@ pgrowlocks(PG_FUNCTION_ARGS)
100101
rel = heap_openrv(relrv, AccessShareLock);
101102
scan = heap_beginscan(rel, SnapshotNow, 0, NULL);
102103
mydata = palloc(sizeof(*mydata));
104+
mydata->rel = rel;
103105
mydata->scan = scan;
104106
mydata->ncolumns = tupdesc->natts;
105107
funcctx->user_fctx = mydata;
@@ -222,7 +224,7 @@ pgrowlocks(PG_FUNCTION_ARGS)
222224
}
223225

224226
heap_endscan(scan);
225-
heap_close(scan->rs_rd, AccessShareLock);
227+
heap_close(mydata->rel, AccessShareLock);
226228

227229
SRF_RETURN_DONE(funcctx);
228230
}

0 commit comments

Comments
 (0)