1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-25 20:23:07 +03:00

Convert oidvector and int2vector into variable-length arrays. This

change saves a great deal of space in pg_proc and its primary index,
and it eliminates the former requirement that INDEX_MAX_KEYS and
FUNC_MAX_ARGS have the same value.  INDEX_MAX_KEYS is still embedded
in the on-disk representation (because it affects index tuple header
size), but FUNC_MAX_ARGS is not.  I believe it would now be possible
to increase FUNC_MAX_ARGS at little cost, but haven't experimented yet.
There are still a lot of vestigial references to FUNC_MAX_ARGS, which
I will clean up in a separate pass.  However, getting rid of it
altogether would require changing the FunctionCallInfoData struct,
and I'm not sure I want to buy into that.
This commit is contained in:
Tom Lane
2005-03-29 00:17:27 +00:00
parent 119191609c
commit 70c9763d48
61 changed files with 819 additions and 581 deletions

View File

@@ -13,7 +13,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.73 2004/12/31 21:59:38 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/catalog/namespace.c,v 1.74 2005/03/29 00:16:56 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -471,25 +471,22 @@ FuncnameGetCandidates(List *names, int nargs)
recomputeNamespacePath();
}
/* Search syscache by name and (optionally) nargs only */
if (nargs >= 0)
catlist = SearchSysCacheList(PROCNAMENSP, 2,
CStringGetDatum(funcname),
Int16GetDatum(nargs),
0, 0);
else
catlist = SearchSysCacheList(PROCNAMENSP, 1,
CStringGetDatum(funcname),
0, 0, 0);
/* Search syscache by name only */
catlist = SearchSysCacheList(PROCNAMEARGSNSP, 1,
CStringGetDatum(funcname),
0, 0, 0);
for (i = 0; i < catlist->n_members; i++)
{
HeapTuple proctup = &catlist->members[i]->tuple;
Form_pg_proc procform = (Form_pg_proc) GETSTRUCT(proctup);
int pronargs = procform->pronargs;
int pathpos = 0;
FuncCandidateList newResult;
nargs = procform->pronargs;
/* Ignore if it doesn't match requested argument count */
if (nargs >= 0 && pronargs != nargs)
continue;
if (OidIsValid(namespaceId))
{
@@ -529,9 +526,10 @@ FuncnameGetCandidates(List *names, int nargs)
if (catlist->ordered)
{
if (nargs == resultList->nargs &&
memcmp(procform->proargtypes, resultList->args,
nargs * sizeof(Oid)) == 0)
if (pronargs == resultList->nargs &&
memcmp(procform->proargtypes.values,
resultList->args,
pronargs * sizeof(Oid)) == 0)
prevResult = resultList;
else
prevResult = NULL;
@@ -542,9 +540,10 @@ FuncnameGetCandidates(List *names, int nargs)
prevResult;
prevResult = prevResult->next)
{
if (nargs == prevResult->nargs &&
memcmp(procform->proargtypes, prevResult->args,
nargs * sizeof(Oid)) == 0)
if (pronargs == prevResult->nargs &&
memcmp(procform->proargtypes.values,
prevResult->args,
pronargs * sizeof(Oid)) == 0)
break;
}
}
@@ -567,11 +566,12 @@ FuncnameGetCandidates(List *names, int nargs)
*/
newResult = (FuncCandidateList)
palloc(sizeof(struct _FuncCandidateList) - sizeof(Oid)
+ nargs * sizeof(Oid));
+ pronargs * sizeof(Oid));
newResult->pathpos = pathpos;
newResult->oid = HeapTupleGetOid(proctup);
newResult->nargs = nargs;
memcpy(newResult->args, procform->proargtypes, nargs * sizeof(Oid));
newResult->nargs = pronargs;
memcpy(newResult->args, procform->proargtypes.values,
pronargs * sizeof(Oid));
newResult->next = resultList;
resultList = newResult;
@@ -632,7 +632,7 @@ FunctionIsVisible(Oid funcid)
for (; clist; clist = clist->next)
{
if (memcmp(clist->args, procform->proargtypes,
if (memcmp(clist->args, procform->proargtypes.values,
nargs * sizeof(Oid)) == 0)
{
/* Found the expected entry; is it the right proc? */