diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-29 00:17:27 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-03-29 00:17:27 +0000 |
| commit | 70c9763d4815ac847f0f7694f43eb6a59a236868 (patch) | |
| tree | 7d8aa05f668f1ef7809ff521b6c1e12d31125fd7 /src/backend/optimizer | |
| parent | 119191609c507528b20d74c59be69f2129127575 (diff) | |
| download | postgresql-70c9763d4815ac847f0f7694f43eb6a59a236868.tar.gz | |
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.
Diffstat (limited to 'src/backend/optimizer')
| -rw-r--r-- | src/backend/optimizer/util/clauses.c | 43 | ||||
| -rw-r--r-- | src/backend/optimizer/util/plancat.c | 6 |
2 files changed, 26 insertions, 23 deletions
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c index 15418d4e95..76255de53d 100644 --- a/src/backend/optimizer/util/clauses.c +++ b/src/backend/optimizer/util/clauses.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.190 2005/03/28 00:58:24 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/clauses.c,v 1.191 2005/03/29 00:17:02 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -421,15 +421,16 @@ count_agg_clauses_walker(Node *node, AggClauseCounts *counts) if (aggtranstype == ANYARRAYOID || aggtranstype == ANYELEMENTOID) { /* have to fetch the agg's declared input type... */ - Oid agg_arg_types[FUNC_MAX_ARGS]; + Oid *agg_arg_types; int agg_nargs; (void) get_func_signature(aggref->aggfnoid, - agg_arg_types, &agg_nargs); + &agg_arg_types, &agg_nargs); Assert(agg_nargs == 1); aggtranstype = resolve_generic_type(aggtranstype, inputType, agg_arg_types[0]); + pfree(agg_arg_types); } /* @@ -2187,7 +2188,7 @@ inline_function(Oid funcid, Oid result_type, List *args, { Form_pg_proc funcform = (Form_pg_proc) GETSTRUCT(func_tuple); bool polymorphic = false; - Oid argtypes[FUNC_MAX_ARGS]; + Oid *argtypes; char *src; Datum tmp; bool isNull; @@ -2220,22 +2221,6 @@ inline_function(Oid funcid, Oid result_type, List *args, if (pg_proc_aclcheck(funcid, GetUserId(), ACL_EXECUTE) != ACLCHECK_OK) return NULL; - /* Check for polymorphic arguments, and substitute actual arg types */ - memcpy(argtypes, funcform->proargtypes, FUNC_MAX_ARGS * sizeof(Oid)); - for (i = 0; i < funcform->pronargs; i++) - { - if (argtypes[i] == ANYARRAYOID || - argtypes[i] == ANYELEMENTOID) - { - polymorphic = true; - argtypes[i] = exprType((Node *) list_nth(args, i)); - } - } - - if (funcform->prorettype == ANYARRAYOID || - funcform->prorettype == ANYELEMENTOID) - polymorphic = true; - /* * Setup error traceback support for ereport(). This is so that we * can finger the function that bad information came from. @@ -2256,6 +2241,24 @@ inline_function(Oid funcid, Oid result_type, List *args, ALLOCSET_DEFAULT_MAXSIZE); oldcxt = MemoryContextSwitchTo(mycxt); + /* Check for polymorphic arguments, and substitute actual arg types */ + argtypes = (Oid *) palloc(funcform->pronargs * sizeof(Oid)); + memcpy(argtypes, funcform->proargtypes.values, + funcform->pronargs * sizeof(Oid)); + for (i = 0; i < funcform->pronargs; i++) + { + if (argtypes[i] == ANYARRAYOID || + argtypes[i] == ANYELEMENTOID) + { + polymorphic = true; + argtypes[i] = exprType((Node *) list_nth(args, i)); + } + } + + if (funcform->prorettype == ANYARRAYOID || + funcform->prorettype == ANYELEMENTOID) + polymorphic = true; + /* Fetch and parse the function body */ tmp = SysCacheGetAttr(PROCOID, func_tuple, diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 6099211ba4..c64f2aad1f 100644 --- a/src/backend/optimizer/util/plancat.c +++ b/src/backend/optimizer/util/plancat.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.102 2005/03/27 06:29:42 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/optimizer/util/plancat.c,v 1.103 2005/03/29 00:17:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -137,8 +137,8 @@ get_relation_info(Oid relationObjectId, RelOptInfo *rel) for (i = 0; i < ncolumns; i++) { - info->classlist[i] = index->indclass[i]; - info->indexkeys[i] = index->indkey[i]; + info->classlist[i] = indexRelation->rd_indclass->values[i]; + info->indexkeys[i] = index->indkey.values[i]; } info->relam = indexRelation->rd_rel->relam; |
