diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-18 19:08:25 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-18 19:08:25 +0000 |
commit | bd272cace63effa23d68a6b344a07e326b6a41e2 (patch) | |
tree | 3026c545c238bd38eadc7fb1fac89d636cf51673 /src/backend/parser/parse_oper.c | |
parent | 6c86fd5ba49bc03949ea1c788023f39da9c0b9fe (diff) | |
download | postgresql-bd272cace63effa23d68a6b344a07e326b6a41e2.tar.gz postgresql-bd272cace63effa23d68a6b344a07e326b6a41e2.zip |
Mega-commit to make heap_open/heap_openr/heap_close take an
additional argument specifying the kind of lock to acquire/release (or
'NoLock' to do no lock processing). Ensure that all relations are locked
with some appropriate lock level before being examined --- this ensures
that relevant shared-inval messages have been processed and should prevent
problems caused by concurrent VACUUM. Fix several bugs having to do with
mismatched increment/decrement of relation ref count and mismatched
heap_open/close (which amounts to the same thing). A bogus ref count on
a relation doesn't matter much *unless* a SI Inval message happens to
arrive at the wrong time, which is probably why we got away with this
sloppiness for so long. Repair missing grab of AccessExclusiveLock in
DROP TABLE, ALTER/RENAME TABLE, etc, as noted by Hiroshi.
Recommend 'make clean all' after pulling this update; I modified the
Relation struct layout slightly.
Will post further discussion to pghackers list shortly.
Diffstat (limited to 'src/backend/parser/parse_oper.c')
-rw-r--r-- | src/backend/parser/parse_oper.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 8f82e58517d..5a5c8709969 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.31 1999/08/26 04:59:15 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.32 1999/09/18 19:07:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -75,7 +75,6 @@ binary_oper_get_candidates(char *opname, HeapScanDesc pg_operator_scan; HeapTuple tup; Form_pg_operator oper; - int nkeys; int ncandidates = 0; ScanKeyData opKey[3]; @@ -91,13 +90,11 @@ binary_oper_get_candidates(char *opname, F_CHAREQ, CharGetDatum('b')); - nkeys = 2; - - pg_operator_desc = heap_openr(OperatorRelationName); + pg_operator_desc = heap_openr(OperatorRelationName, AccessShareLock); pg_operator_scan = heap_beginscan(pg_operator_desc, 0, SnapshotSelf, /* ??? */ - nkeys, + 2, opKey); while (HeapTupleIsValid(tup = heap_getnext(pg_operator_scan, 0))) @@ -114,7 +111,7 @@ binary_oper_get_candidates(char *opname, } heap_endscan(pg_operator_scan); - heap_close(pg_operator_desc); + heap_close(pg_operator_desc, AccessShareLock); return ncandidates; } /* binary_oper_get_candidates() */ @@ -522,7 +519,7 @@ unary_oper_get_candidates(char *op, fmgr_info(F_CHAREQ, (FmgrInfo *) &opKey[1].sk_func); opKey[1].sk_argument = CharGetDatum(rightleft); - pg_operator_desc = heap_openr(OperatorRelationName); + pg_operator_desc = heap_openr(OperatorRelationName, AccessShareLock); pg_operator_scan = heap_beginscan(pg_operator_desc, 0, SnapshotSelf, /* ??? */ @@ -545,7 +542,7 @@ unary_oper_get_candidates(char *op, } heap_endscan(pg_operator_scan); - heap_close(pg_operator_desc); + heap_close(pg_operator_desc, AccessShareLock); return ncandidates; } /* unary_oper_get_candidates() */ |