diff options
author | Robert Haas <rhaas@postgresql.org> | 2010-02-14 18:42:19 +0000 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2010-02-14 18:42:19 +0000 |
commit | e26c539e9f326ea843c0ed005af093b56b55cd4d (patch) | |
tree | 4f3830d394229b747cbceeab3cdbbfccccec74d1 /src/backend/commands/analyze.c | |
parent | 1012492bc0bfb322d59db17e17735d17d634e264 (diff) |
Wrap calls to SearchSysCache and related functions using macros.
The purpose of this change is to eliminate the need for every caller
of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists,
GetSysCacheOid, and SearchSysCacheList to know the maximum number
of allowable keys for a syscache entry (currently 4). This will
make it far easier to increase the maximum number of keys in a
future release should we choose to do so, and it makes the code
shorter, too.
Design and review by Tom Lane.
Diffstat (limited to 'src/backend/commands/analyze.c')
-rw-r--r-- | src/backend/commands/analyze.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 47179ec602f..32fb44051c6 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.150 2010/02/08 04:33:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/analyze.c,v 1.151 2010/02/14 18:42:13 rhaas Exp $ * *------------------------------------------------------------------------- */ @@ -827,9 +827,7 @@ examine_attribute(Relation onerel, int attnum) stats = (VacAttrStats *) palloc0(sizeof(VacAttrStats)); stats->attr = (Form_pg_attribute) palloc(ATTRIBUTE_FIXED_PART_SIZE); memcpy(stats->attr, attr, ATTRIBUTE_FIXED_PART_SIZE); - typtuple = SearchSysCache(TYPEOID, - ObjectIdGetDatum(attr->atttypid), - 0, 0, 0); + typtuple = SearchSysCache1(TYPEOID, ObjectIdGetDatum(attr->atttypid)); if (!HeapTupleIsValid(typtuple)) elog(ERROR, "cache lookup failed for type %u", attr->atttypid); stats->attrtype = (Form_pg_type) palloc(sizeof(FormData_pg_type)); @@ -1633,11 +1631,10 @@ update_attstats(Oid relid, bool inh, int natts, VacAttrStats **vacattrstats) } /* Is there already a pg_statistic tuple for this attribute? */ - oldtup = SearchSysCache(STATRELATTINH, - ObjectIdGetDatum(relid), - Int16GetDatum(stats->attr->attnum), - BoolGetDatum(inh), - 0); + oldtup = SearchSysCache3(STATRELATTINH, + ObjectIdGetDatum(relid), + Int16GetDatum(stats->attr->attnum), + BoolGetDatum(inh)); if (HeapTupleIsValid(oldtup)) { |