From c13d808d60f7d937563fc452a645c98955b79174 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 20 May 2002 23:51:44 +0000 Subject: Restructure indexscan API (index_beginscan, index_getnext) per yesterday's proposal to pghackers. Also remove unnecessary parameters to heap_beginscan, heap_rescan. I modified pg_proc.h to reflect the new numbers of parameters for the AM interface routines, but did not force an initdb because nothing actually looks at those fields. --- src/backend/commands/async.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/backend/commands/async.c') diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 5838883b46..ed503ea97b 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -204,8 +204,8 @@ Async_Listen(char *relname, int pid) lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); /* Detect whether we are already listening on this relname */ - scan = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey) NULL); - while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) + scan = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); + while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(tuple); @@ -305,8 +305,8 @@ Async_Unlisten(char *relname, int pid) lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); - scan = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey) NULL); - while (HeapTupleIsValid(tuple = heap_getnext(scan, 0))) + scan = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); + while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(tuple); @@ -369,9 +369,9 @@ Async_UnlistenAll(void) Anum_pg_listener_pid, F_INT4EQ, Int32GetDatum(MyProcPid)); - scan = heap_beginscan(lRel, 0, SnapshotNow, 1, key); + scan = heap_beginscan(lRel, SnapshotNow, 1, key); - while (HeapTupleIsValid(lTuple = heap_getnext(scan, 0))) + while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) simple_heap_delete(lRel, &lTuple->t_self); heap_endscan(scan); @@ -472,9 +472,9 @@ AtCommit_Notify(void) lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); tdesc = RelationGetDescr(lRel); - scan = heap_beginscan(lRel, 0, SnapshotNow, 0, (ScanKey) NULL); + scan = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); - while (HeapTupleIsValid(lTuple = heap_getnext(scan, 0))) + while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(lTuple); char *relname = NameStr(listener->relname); @@ -773,7 +773,7 @@ ProcessIncomingNotify(void) Anum_pg_listener_pid, F_INT4EQ, Int32GetDatum(MyProcPid)); - scan = heap_beginscan(lRel, 0, SnapshotNow, 1, key); + scan = heap_beginscan(lRel, SnapshotNow, 1, key); /* Prepare data for rewriting 0 into notification field */ nulls[0] = nulls[1] = nulls[2] = ' '; @@ -782,7 +782,7 @@ ProcessIncomingNotify(void) value[0] = value[1] = value[2] = (Datum) 0; value[Anum_pg_listener_notify - 1] = Int32GetDatum(0); - while (HeapTupleIsValid(lTuple = heap_getnext(scan, 0))) + while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(lTuple); char *relname = NameStr(listener->relname); -- cgit v1.2.3