diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-11-16 22:30:52 +0000 |
commit | a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d (patch) | |
tree | 1c32737389b2530e7152dc2287161b36d9001e8c /src/backend/parser/parse_agg.c | |
parent | cff23842a4c68301ddf34559c7af383bb5557054 (diff) | |
download | postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.tar.gz postgresql-a933ee38bbb8dffbc48a3363a94ff6f2a9f7964d.zip |
Change SearchSysCache coding conventions so that a reference count is
maintained for each cache entry. A cache entry will not be freed until
the matching ReleaseSysCache call has been executed. This eliminates
worries about cache entries getting dropped while still in use. See
my posting to pg-hackers of even date for more info.
Diffstat (limited to 'src/backend/parser/parse_agg.c')
-rw-r--r-- | src/backend/parser/parse_agg.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index e7d8fe8d3b7..1dc31dc1f07 100644 --- a/src/backend/parser/parse_agg.c +++ b/src/backend/parser/parse_agg.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.42 2000/09/29 18:21:36 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.43 2000/11/16 22:30:27 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -190,18 +190,18 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype, List *args, bool agg_star, bool agg_distinct, int precedence) { - HeapTuple theAggTuple; + HeapTuple aggtuple; Form_pg_aggregate aggform; Aggref *aggref; - theAggTuple = SearchSysCacheTuple(AGGNAME, - PointerGetDatum(aggname), - ObjectIdGetDatum(basetype), - 0, 0); + aggtuple = SearchSysCache(AGGNAME, + PointerGetDatum(aggname), + ObjectIdGetDatum(basetype), + 0, 0); /* shouldn't happen --- caller should have checked already */ - if (!HeapTupleIsValid(theAggTuple)) + if (!HeapTupleIsValid(aggtuple)) agg_error("ParseAgg", aggname, basetype); - aggform = (Form_pg_aggregate) GETSTRUCT(theAggTuple); + aggform = (Form_pg_aggregate) GETSTRUCT(aggtuple); /* * There used to be a really ugly hack for count(*) here. @@ -225,6 +225,8 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype, aggref->aggstar = agg_star; aggref->aggdistinct = agg_distinct; + ReleaseSysCache(aggtuple); + pstate->p_hasAggs = true; return aggref; |