1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +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

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.126 2004/12/31 22:00:27 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/parser/parse_coerce.c,v 2.127 2005/03/29 00:17:04 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -615,9 +615,9 @@ build_coercion_expression(Node *node, Oid funcId,
Assert(!procstruct->proisagg);
nargs = procstruct->pronargs;
Assert(nargs >= 1 && nargs <= 3);
/* Assert(procstruct->proargtypes[0] == exprType(node)); */
Assert(nargs < 2 || procstruct->proargtypes[1] == INT4OID);
Assert(nargs < 3 || procstruct->proargtypes[2] == BOOLOID);
/* Assert(procstruct->proargtypes.values[0] == exprType(node)); */
Assert(nargs < 2 || procstruct->proargtypes.values[1] == INT4OID);
Assert(nargs < 3 || procstruct->proargtypes.values[2] == BOOLOID);
ReleaseSysCache(tp);
@ -1672,11 +1672,21 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
* of array types. If so, and if the element types have a
* suitable cast, use array_type_coerce() or
* array_type_length_coerce().
*
* Hack: disallow coercions to oidvector and int2vector, which
* otherwise tend to capture coercions that should go to "real" array
* types. We want those types to be considered "real" arrays for many
* purposes, but not this one. (Also, array_type_coerce isn't
* guaranteed to produce an output that meets the restrictions of
* these datatypes, such as being 1-dimensional.)
*/
Oid targetElemType;
Oid sourceElemType;
Oid elemfuncid;
if (targetTypeId == OIDVECTOROID || targetTypeId == INT2VECTOROID)
return false;
if ((targetElemType = get_element_type(targetTypeId)) != InvalidOid &&
(sourceElemType = get_element_type(sourceTypeId)) != InvalidOid)
{
@ -1691,11 +1701,7 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
else
{
/* does the function take a typmod arg? */
Oid argtypes[FUNC_MAX_ARGS];
int nargs;
(void) get_func_signature(elemfuncid, argtypes, &nargs);
if (nargs > 1)
if (get_func_nargs(elemfuncid) > 1)
*funcid = F_ARRAY_TYPE_LENGTH_COERCE;
else
*funcid = F_ARRAY_TYPE_COERCE;