diff options
Diffstat (limited to 'src/backend/utils/adt')
| -rw-r--r-- | src/backend/utils/adt/not_in.c | 13 | ||||
| -rw-r--r-- | src/backend/utils/adt/regproc.c | 33 | ||||
| -rw-r--r-- | src/backend/utils/adt/selfuncs.c | 8 | ||||
| -rw-r--r-- | src/backend/utils/adt/sets.c | 8 |
4 files changed, 23 insertions, 39 deletions
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c index 2ef45f63e4..1a851cf7e5 100644 --- a/src/backend/utils/adt/not_in.c +++ b/src/backend/utils/adt/not_in.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.20 1999/07/17 20:17:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.21 1999/09/18 19:07:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -58,12 +58,7 @@ int4notin(int32 not_in_arg, char *relation_and_attr) /* Open the relation and get a relation descriptor */ - relation_to_scan = heap_openr(relation); - if (!RelationIsValid(relation_to_scan)) - { - elog(ERROR, "int4notin: unknown relation %s", - relation); - } + relation_to_scan = heap_openr(relation, AccessShareLock); /* Find the column to search */ @@ -95,7 +90,9 @@ int4notin(int32 not_in_arg, char *relation_and_attr) } /* close the relation */ - heap_close(relation_to_scan); + heap_endscan(scan_descriptor); + heap_close(relation_to_scan, AccessShareLock); + return retval; } diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index 754eea3a96..b3179e864c 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.42 1999/07/17 20:17:59 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.43 1999/09/18 19:07:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -78,7 +78,7 @@ regprocin(char *pro_name_or_oid) (RegProcedure) F_NAMEEQ, PointerGetDatum(pro_name_or_oid)); - hdesc = heap_openr(ProcedureRelationName); + hdesc = heap_openr(ProcedureRelationName, AccessShareLock); idesc = index_openr(ProcedureNameIndex); sd = index_beginscan(idesc, false, 1, skey); @@ -102,6 +102,7 @@ regprocin(char *pro_name_or_oid) index_endscan(sd); pfree(sd); index_close(idesc); + heap_close(hdesc, AccessShareLock); if (matches > 1) elog(ERROR, "There is more than one procedure named %s.\n\tSupply the pg_proc oid inside single quotes.", pro_name_or_oid); @@ -116,13 +117,7 @@ regprocin(char *pro_name_or_oid) ScanKeyData key; bool isnull; - proc = heap_openr(ProcedureRelationName); - if (!RelationIsValid(proc)) - { - elog(ERROR, "regprocin: could not open %s", - ProcedureRelationName); - return 0; - } + proc = heap_openr(ProcedureRelationName, AccessShareLock); ScanKeyEntryInitialize(&key, (bits16) 0, (AttrNumber) 1, @@ -132,8 +127,8 @@ regprocin(char *pro_name_or_oid) procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key); if (!HeapScanIsValid(procscan)) { - heap_close(proc); - elog(ERROR, "regprocin: could not being scan of %s", + heap_close(proc, AccessShareLock); + elog(ERROR, "regprocin: could not begin scan of %s", ProcedureRelationName); return 0; } @@ -151,7 +146,7 @@ regprocin(char *pro_name_or_oid) result = (RegProcedure) 0; heap_endscan(procscan); - heap_close(proc); + heap_close(proc, AccessShareLock); } return (int32) result; @@ -193,12 +188,7 @@ regprocout(RegProcedure proid) HeapScanDesc procscan; ScanKeyData key; - proc = heap_openr(ProcedureRelationName); - if (!RelationIsValid(proc)) - { - elog(ERROR, "regprocout: could not open %s", ProcedureRelationName); - return 0; - } + proc = heap_openr(ProcedureRelationName, AccessShareLock); ScanKeyEntryInitialize(&key, (bits16) 0, (AttrNumber) ObjectIdAttributeNumber, @@ -208,8 +198,8 @@ regprocout(RegProcedure proid) procscan = heap_beginscan(proc, 0, SnapshotNow, 1, &key); if (!HeapScanIsValid(procscan)) { - heap_close(proc); - elog(ERROR, "regprocout: could not being scan of %s", + heap_close(proc, AccessShareLock); + elog(ERROR, "regprocout: could not begin scan of %s", ProcedureRelationName); return 0; } @@ -232,8 +222,7 @@ regprocout(RegProcedure proid) result[1] = '\0'; } heap_endscan(procscan); - heap_close(proc); - return result; + heap_close(proc, AccessShareLock); } return result; diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 1b2d58c075..e14e537555 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.40 1999/09/09 02:35:58 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.41 1999/09/18 19:07:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -598,7 +598,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid typid, int32 typmod, HeapTuple typeTuple; FmgrInfo inputproc; - rel = heap_openr(StatisticRelationName); + rel = heap_openr(StatisticRelationName, AccessShareLock); key[0].sk_argument = ObjectIdGetDatum(relid); key[1].sk_argument = Int16GetDatum((int16) attnum); @@ -609,7 +609,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid typid, int32 typmod, { /* no such stats entry */ heap_endscan(scan); - heap_close(rel); + heap_close(rel, AccessShareLock); return false; } @@ -694,7 +694,7 @@ getattstatistics(Oid relid, AttrNumber attnum, Oid typid, int32 typmod, } heap_endscan(scan); - heap_close(rel); + heap_close(rel, AccessShareLock); return true; } diff --git a/src/backend/utils/adt/sets.c b/src/backend/utils/adt/sets.c index 05bc16b92a..46dbca9d69 100644 --- a/src/backend/utils/adt/sets.c +++ b/src/backend/utils/adt/sets.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.25 1999/07/17 20:18:00 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.26 1999/09/18 19:07:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -100,8 +100,7 @@ SetDefine(char *querystr, char *typename) replNull[i] = ' '; /* change the pg_proc tuple */ - procrel = heap_openr(ProcedureRelationName); - LockRelation(procrel, AccessExclusiveLock); + procrel = heap_openr(ProcedureRelationName, RowExclusiveLock); tup = SearchSysCacheTuple(PROOID, ObjectIdGetDatum(setoid), @@ -131,8 +130,7 @@ SetDefine(char *querystr, char *typename) CatalogIndexInsert(idescs, Num_pg_proc_indices, procrel, newtup); CatalogCloseIndices(Num_pg_proc_indices, idescs); } - UnlockRelation(procrel, AccessExclusiveLock); - heap_close(procrel); + heap_close(procrel, RowExclusiveLock); } return setoid; } |
