From 8a093d0ae3a139d912ce9f8ba2cde294de79e12e Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 10 Jan 2000 17:14:46 +0000 Subject: [PATCH] Make number of args to a function configurable. --- src/backend/access/hash/hashfunc.c | 4 +- src/backend/access/nbtree/nbtcompare.c | 4 +- src/backend/catalog/pg_aggregate.c | 6 +- src/backend/catalog/pg_operator.c | 18 +-- src/backend/catalog/pg_proc.c | 10 +- src/backend/catalog/pg_type.c | 6 +- src/backend/commands/_deadcode/recipe.c | 10 +- src/backend/commands/comment.c | 198 ++++++++++++------------ src/backend/commands/indexcmds.c | 4 +- src/backend/commands/proclang.c | 4 +- src/backend/commands/remove.c | 10 +- src/backend/commands/trigger.c | 70 ++++----- src/backend/executor/execQual.c | 6 +- src/backend/libpq/be-pqexec.c | 12 +- src/backend/parser/parse_coerce.c | 6 +- src/backend/parser/parse_func.c | 30 ++-- src/backend/parser/parse_target.c | 6 +- src/backend/tcop/fastpath.c | 12 +- src/backend/utils/adt/regproc.c | 13 +- src/backend/utils/adt/selfuncs.c | 10 +- src/backend/utils/fmgr/fmgr.c | 93 +++++++++-- src/bin/pg_dump/pg_dump.c | 108 ++++++------- src/bin/pg_dump/pg_dump.h | 4 +- src/include/access/funcindex.h | 4 +- src/include/config.h.in | 4 +- src/include/parser/parse_func.h | 5 +- src/include/utils/rel.h | 4 +- src/pl/plpgsql/src/pl_comp.c | 4 +- src/pl/plpgsql/src/plpgsql.h | 4 +- src/pl/tcl/pltcl.c | 10 +- 30 files changed, 374 insertions(+), 305 deletions(-) diff --git a/src/backend/access/hash/hashfunc.c b/src/backend/access/hash/hashfunc.c index e318777700..3b64450707 100644 --- a/src/backend/access/hash/hashfunc.c +++ b/src/backend/access/hash/hashfunc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.21 2000/01/10 16:13:10 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/hash/hashfunc.c,v 1.22 2000/01/10 17:14:28 momjian Exp $ * * NOTES * These functions are stored in pg_amproc. For each operator class @@ -145,7 +145,7 @@ hashoidvector(Oid *key) int i; uint32 result = 0; - for (i = 0; i < 8; i++) + for (i = 0; i < INDEX_MAX_KEYS; i++) result = result ^ (~(uint32) key[i]); return result; } diff --git a/src/backend/access/nbtree/nbtcompare.c b/src/backend/access/nbtree/nbtcompare.c index 57c3f981a3..fd84db3e5c 100644 --- a/src/backend/access/nbtree/nbtcompare.c +++ b/src/backend/access/nbtree/nbtcompare.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.29 2000/01/10 16:13:10 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtcompare.c,v 1.30 2000/01/10 17:14:29 momjian Exp $ * * NOTES * These functions are stored in pg_amproc. For each operator class @@ -98,7 +98,7 @@ btoidvectorcmp(Oid *a, Oid *b) { int i; - for (i = 0; i < 8; i++) + for (i = 0; i < INDEX_MAX_KEYS; i++) /* we use this because we need the int4gt, etc */ if (!int4eq(a[i], b[i])) { diff --git a/src/backend/catalog/pg_aggregate.c b/src/backend/catalog/pg_aggregate.c index e7e61178c2..7a5377fd03 100644 --- a/src/backend/catalog/pg_aggregate.c +++ b/src/backend/catalog/pg_aggregate.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.26 1999/11/22 17:55:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.27 2000/01/10 17:14:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -71,11 +71,11 @@ AggregateCreate(char *aggName, Oid xret1 = InvalidOid; Oid xret2 = InvalidOid; Oid fret = InvalidOid; - Oid fnArgs[8]; + Oid fnArgs[FUNC_MAX_ARGS]; NameData aname; TupleDesc tupDesc; - MemSet(fnArgs, 0, 8 * sizeof(Oid)); + MemSet(fnArgs, 0, FUNC_MAX_ARGS * sizeof(Oid)); /* sanity checks */ if (!aggName) diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c index f30482f4db..a143c807c7 100644 --- a/src/backend/catalog/pg_operator.c +++ b/src/backend/catalog/pg_operator.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.46 2000/01/05 18:23:45 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.47 2000/01/10 17:14:31 momjian Exp $ * * NOTES * these routines moved here from commands/define.c and somewhat cleaned up. @@ -482,7 +482,7 @@ OperatorDef(char *operatorName, bool rightDefined = false; bool selfCommutator = false; char *name[4]; - Oid typeId[8]; + Oid typeId[FUNC_MAX_ARGS]; int nargs; NameData oname; TupleDesc tupDesc; @@ -556,7 +556,7 @@ OperatorDef(char *operatorName, * have to worry about deleting them later. * ---------------- */ - MemSet(typeId, 0, 8 * sizeof(Oid)); + MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid)); if (!leftTypeName) { typeId[0] = rightTypeId; @@ -592,7 +592,7 @@ OperatorDef(char *operatorName, */ if (restrictionName) { /* optional */ - MemSet(typeId, 0, 8 * sizeof(Oid)); + MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid)); typeId[0] = OIDOID; /* operator OID */ typeId[1] = OIDOID; /* relation OID */ typeId[2] = INT2OID; /* attribute number */ @@ -617,7 +617,7 @@ OperatorDef(char *operatorName, */ if (joinName) { /* optional */ - MemSet(typeId, 0, 8 * sizeof(Oid)); + MemSet(typeId, 0, FUNC_MAX_ARGS * sizeof(Oid)); typeId[0] = OIDOID; /* operator OID */ typeId[1] = OIDOID; /* relation OID 1 */ typeId[2] = INT2OID; /* attribute number 1 */ @@ -923,11 +923,11 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) setheapoverride(true); heap_update(pg_operator_desc, &tup->t_self, tup, NULL); setheapoverride(false); - + if (RelationGetForm(pg_operator_desc)->relhasindex) { Relation idescs[Num_pg_operator_indices]; - + CatalogOpenIndices(Num_pg_operator_indices, Name_pg_operator_indices, idescs); CatalogIndexInsert(idescs, Num_pg_operator_indices, pg_operator_desc, tup); CatalogCloseIndices(Num_pg_operator_indices, idescs); @@ -961,7 +961,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) if (RelationGetForm(pg_operator_desc)->relhasindex) { Relation idescs[Num_pg_operator_indices]; - + CatalogOpenIndices(Num_pg_operator_indices, Name_pg_operator_indices, idescs); CatalogIndexInsert(idescs, Num_pg_operator_indices, pg_operator_desc, tup); CatalogCloseIndices(Num_pg_operator_indices, idescs); @@ -1001,7 +1001,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId) if (RelationGetForm(pg_operator_desc)->relhasindex) { Relation idescs[Num_pg_operator_indices]; - + CatalogOpenIndices(Num_pg_operator_indices, Name_pg_operator_indices, idescs); CatalogIndexInsert(idescs, Num_pg_operator_indices, pg_operator_desc, tup); CatalogCloseIndices(Num_pg_operator_indices, idescs); diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c index 3c0ca76890..9eea8cd126 100644 --- a/src/backend/catalog/pg_proc.c +++ b/src/backend/catalog/pg_proc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.36 1999/11/22 17:55:58 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_proc.c,v 1.37 2000/01/10 17:14:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -61,7 +61,7 @@ ProcedureCreate(char *procedureName, List *x; List *querytree_list; List *plan_list; - Oid typev[8]; + Oid typev[FUNC_MAX_ARGS]; Oid relid; Oid toid; NameData procname; @@ -75,13 +75,13 @@ ProcedureCreate(char *procedureName, Assert(PointerIsValid(probin)); parameterCount = 0; - MemSet(typev, 0, 8 * sizeof(Oid)); + MemSet(typev, 0, FUNC_MAX_ARGS * sizeof(Oid)); foreach(x, argList) { Value *t = lfirst(x); - if (parameterCount == 8) - elog(ERROR, "Procedures cannot take more than 8 arguments"); + if (parameterCount == FUNC_MAX_ARGS) + elog(ERROR, "Procedures cannot take more than %d arguments",FUNC_MAX_ARGS); if (strcmp(strVal(t), "opaque") == 0) { diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c index 4a2bdca1c1..b7226146b9 100644 --- a/src/backend/catalog/pg_type.c +++ b/src/backend/catalog/pg_type.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.44 1999/12/16 22:19:39 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.45 2000/01/10 17:14:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -305,7 +305,7 @@ TypeCreate(char *typeName, bool defined; NameData name; TupleDesc tupDesc; - Oid argList[8]; + Oid argList[FUNC_MAX_ARGS]; static ScanKeyData typeKey[1] = { {0, Anum_pg_type_typname, F_NAMEEQ} @@ -393,7 +393,7 @@ TypeCreate(char *typeName, * First look for a 1-argument func with all argtypes 0. This is * valid for all four kinds of procedure. */ - MemSet(argList, 0, 8 * sizeof(Oid)); + MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); tup = SearchSysCacheTuple(PROCNAME, PointerGetDatum(procname), diff --git a/src/backend/commands/_deadcode/recipe.c b/src/backend/commands/_deadcode/recipe.c index e390b03fe8..dc0928fe97 100644 --- a/src/backend/commands/_deadcode/recipe.c +++ b/src/backend/commands/_deadcode/recipe.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.7 1999/07/16 04:58:42 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/_deadcode/Attic/recipe.c,v 1.8 2000/01/10 17:14:33 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -695,14 +695,14 @@ getParamTypes(TgElement * elem, Oid *typev) j; parameterCount = 0; - for (i = 0; i < 8; i++) + for (i = 0; i < FUNC_MAX_ARGS; i++) typev[i] = 0; for (j = 0; j < elem->inTypes->num; j++) { - if (parameterCount == 8) + if (parameterCount == FUNC_MAX_ARGS) { elog(ERROR, - "getParamTypes: Ingredients cannot take > 8 arguments"); + "getParamTypes: Ingredients cannot take > %d arguments",FUNC_MAX_ARGS); } t = elem->inTypes->val[j]; if (strcmp(t, "opaque") == 0) @@ -810,7 +810,7 @@ tg_parseSubQuery(TgRecipe * r, TgNode * n, TeeInfo * teeInfo) { TgElement *elem; char *funcName; - Oid typev[8], /* eight arguments maximum */ + Oid typev[FUNC_MAX_ARGS], /* eight arguments maximum */ relid; int i, parameterCount; diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c index e98f4be885..d560d78621 100644 --- a/src/backend/commands/comment.c +++ b/src/backend/commands/comment.c @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------- * * comment.c - * + * * PostgreSQL object comments utility code. * * Copyright (c) 1999, PostgreSQL Global Development Group @@ -34,10 +34,10 @@ /*------------------------------------------------------------------ * Static Function Prototypes -- - * - * The following protoypes are declared static so as not to conflict - * with any other routines outside this module. These routines are - * called by the public function CommentObject() routine to create + * + * The following protoypes are declared static so as not to conflict + * with any other routines outside this module. These routines are + * called by the public function CommentObject() routine to create * the appropriate comment for the specific object type. *------------------------------------------------------------------ */ @@ -55,10 +55,10 @@ static void CommentTrigger(char *trigger, char *relation, char *comments); /*------------------------------------------------------------------ * CommentObject -- * - * This routine is used to add the associated comment into - * pg_description for the object specified by the paramters handed - * to this routine. If the routine cannot determine an Oid to - * associated with the parameters handed to this routine, an + * This routine is used to add the associated comment into + * pg_description for the object specified by the paramters handed + * to this routine. If the routine cannot determine an Oid to + * associated with the parameters handed to this routine, an * error is thrown. Otherwise the comment is added to pg_description * by calling the CreateComments() routine. If the comments were * empty, CreateComments() will drop any comments associated with @@ -66,9 +66,9 @@ static void CommentTrigger(char *trigger, char *relation, char *comments); *------------------------------------------------------------------ */ -void CommentObject(int objtype, char *objname, char *objproperty, +void CommentObject(int objtype, char *objname, char *objproperty, List *objlist, char *comment) { - + switch (objtype) { case (INDEX): case (SEQUENCE): @@ -102,18 +102,18 @@ void CommentObject(int objtype, char *objname, char *objproperty, break; default: elog(ERROR, "An attempt was made to comment on a unkown type: %i", - objtype); + objtype); } } /*------------------------------------------------------------------ * CreateComments -- - * + * * This routine is handed the oid and the command associated - * with that id and will insert, update, or delete (if the + * with that id and will insert, update, or delete (if the * comment is an empty string or a NULL pointer) the associated - * comment from the system cataloge, pg_description. + * comment from the system cataloge, pg_description. * *------------------------------------------------------------------ */ @@ -147,7 +147,7 @@ void CreateComments(Oid oid, char *comment) { } /*** Now, open pg_description and attempt to find the old tuple ***/ - + ScanKeyEntryInitialize(&entry, 0x0, Anum_pg_description_objoid, F_OIDEQ, ObjectIdGetDatum(oid)); scan = heap_beginscan(description, false, SnapshotNow, 1, &entry); @@ -156,21 +156,21 @@ void CreateComments(Oid oid, char *comment) { /*** If a previous tuple exists, either delete or prep replacement ***/ if (HeapTupleIsValid(searchtuple)) { - + /*** If the comment is blank, call heap_delete, else heap_update ***/ if ((comment == NULL) || (strlen(comment) == 0)) { heap_delete(description, &searchtuple->t_self, NULL); } else { - desctuple = heap_modifytuple(searchtuple, description, values, - nulls, replaces); + desctuple = heap_modifytuple(searchtuple, description, values, + nulls, replaces); setheapoverride(true); heap_update(description, &searchtuple->t_self, desctuple, NULL); setheapoverride(false); modified = TRUE; } - } else { + } else { desctuple = heap_formtuple(tupDesc, values, nulls); heap_insert(description, desctuple); modified = TRUE; @@ -179,14 +179,14 @@ void CreateComments(Oid oid, char *comment) { /*** Complete the scan, update indices, if necessary ***/ heap_endscan(scan); - + if (modified) { if (RelationGetForm(description)->relhasindex) { Relation idescs[Num_pg_description_indices]; - - CatalogOpenIndices(Num_pg_description_indices, + + CatalogOpenIndices(Num_pg_description_indices, Name_pg_description_indices, idescs); - CatalogIndexInsert(idescs, Num_pg_description_indices, description, + CatalogIndexInsert(idescs, Num_pg_description_indices, description, desctuple); CatalogCloseIndices(Num_pg_description_indices, idescs); } @@ -198,10 +198,10 @@ void CreateComments(Oid oid, char *comment) { } -/*------------------------------------------------------------------ +/*------------------------------------------------------------------ * DeleteComments -- * - * This routine is used to purge any comments + * This routine is used to purge any comments * associated with the Oid handed to this routine, * regardless of the actual object type. It is * called, for example, when a relation is destroyed. @@ -220,7 +220,7 @@ void DeleteComments(Oid oid) { tupDesc = description->rd_att; /*** Now, open pg_description and attempt to find the old tuple ***/ - + ScanKeyEntryInitialize(&entry, 0x0, Anum_pg_description_objoid, F_OIDEQ, ObjectIdGetDatum(oid)); scan = heap_beginscan(description, false, SnapshotNow, 1, &entry); @@ -228,24 +228,24 @@ void DeleteComments(Oid oid) { /*** If a previous tuple exists, delete it ***/ - if (HeapTupleIsValid(searchtuple)) { + if (HeapTupleIsValid(searchtuple)) { heap_delete(description, &searchtuple->t_self, NULL); - } - + } + /*** Complete the scan, update indices, if necessary ***/ heap_endscan(scan); heap_close(description, RowExclusiveLock); - + } - + /*------------------------------------------------------------------ * CommentRelation -- * - * This routine is used to add/drop a comment from a relation, where + * This routine is used to add/drop a comment from a relation, where * a relation is a TABLE, SEQUENCE, VIEW or INDEX. The routine simply - * finds the relation name by searching the system cache, locating - * the appropriate tuple, and inserting a comment using that + * finds the relation name by searching the system cache, locating + * the appropriate tuple, and inserting a comment using that * tuple's oid. Its parameters are the relation name and comments. *------------------------------------------------------------------ */ @@ -300,10 +300,10 @@ void CommentRelation(int reltype, char *relname, char *comment) { } break; } - + /*** Create the comments using the tuple's oid ***/ - CreateComments(oid, comment); + CreateComments(oid, comment); } @@ -311,11 +311,11 @@ void CommentRelation(int reltype, char *relname, char *comment) { * CommentAttribute -- * * This routine is used to add/drop a comment from an attribute - * such as a table's column. The routine will check security + * such as a table's column. The routine will check security * restrictions and then attempt to fetch the oid of the associated * attribute. If successful, a comment is added/dropped, else an * elog() exception is thrown. The parameters are the relation - * and attribute names, and the comments + * and attribute names, and the comments *------------------------------------------------------------------ */ @@ -332,10 +332,10 @@ void CommentAttribute(char *relname, char *attrname, char *comment) { elog(ERROR, "you are not permitted to comment on class '%s\'", relname); } #endif - + /*** Now, fetch the attribute oid from the system cache ***/ - relation = heap_openr(relname, AccessShareLock); + relation = heap_openr(relname, AccessShareLock); attrtuple = SearchSysCacheTuple(ATTNAME, ObjectIdGetDatum(relation->rd_id), PointerGetDatum(attrname), 0, 0); if (!HeapTupleIsValid(attrtuple)) { @@ -343,14 +343,14 @@ void CommentAttribute(char *relname, char *attrname, char *comment) { attrname, relname); } oid = attrtuple->t_data->t_oid; - + /*** Call CreateComments() to create/drop the comments ***/ CreateComments(oid, comment); /*** Now, close the heap relation and return ***/ - heap_close(relation, AccessShareLock); + heap_close(relation, AccessShareLock); } @@ -358,10 +358,10 @@ void CommentAttribute(char *relname, char *attrname, char *comment) { * CommentDatabase -- * * This routine is used to add/drop any user-comments a user might - * have regarding the specified database. The routine will check - * security for owner permissions, and, if succesful, will then - * attempt to find the oid of the database specified. Once found, - * a comment is added/dropped using the CreateComments() routine. + * have regarding the specified database. The routine will check + * security for owner permissions, and, if succesful, will then + * attempt to find the oid of the database specified. Once found, + * a comment is added/dropped using the CreateComments() routine. *------------------------------------------------------------------ */ @@ -374,7 +374,7 @@ void CommentDatabase(char *database, char *comment) { Oid oid; bool superuser; int4 dba, userid; - char *username; + char *username; /*** First find the tuple in pg_database for the database ***/ @@ -383,7 +383,7 @@ void CommentDatabase(char *database, char *comment) { F_NAMEEQ, NameGetDatum(database)); scan = heap_beginscan(pg_database, 0, SnapshotNow, 1, &entry); dbtuple = heap_getnext(scan, 0); - + /*** Validate database exists, and fetch the dba id and oid ***/ if (!HeapTupleIsValid(dbtuple)) { @@ -391,9 +391,9 @@ void CommentDatabase(char *database, char *comment) { } dba = ((Form_pg_database) GETSTRUCT(dbtuple))->datdba; oid = dbtuple->t_data->t_oid; - + /*** Now, fetch user information ***/ - + username = GetPgUserName(); usertuple = SearchSysCacheTuple(SHADOWNAME, PointerGetDatum(username), 0, 0, 0); @@ -402,9 +402,9 @@ void CommentDatabase(char *database, char *comment) { } userid = ((Form_pg_shadow) GETSTRUCT(usertuple))->usesysid; superuser = ((Form_pg_shadow) GETSTRUCT(usertuple))->usesuper; - + /*** Allow if the userid matches the database dba or is a superuser ***/ - + #ifndef NO_SECURITY if (!(superuser || (userid == dba))) { elog(ERROR, "you are not permitted to comment on database '%s'", @@ -413,11 +413,11 @@ void CommentDatabase(char *database, char *comment) { #endif /*** Create the comments with the pg_database oid ***/ - + CreateComments(oid, comment); - + /*** Complete the scan and close any opened relations ***/ - + heap_endscan(scan); heap_close(pg_database, AccessShareLock); @@ -428,7 +428,7 @@ void CommentDatabase(char *database, char *comment) { * * This routine is used to add/drop any user-comments a user might * have regarding a specified RULE. The rule is specified by name - * and, if found, and the user has appropriate permissions, a + * and, if found, and the user has appropriate permissions, a * comment will be added/dropped using the CreateComments() routine. *------------------------------------------------------------------ */ @@ -441,8 +441,8 @@ void CommentRewrite(char *rule, char *comment) { int aclcheck; /*** First, validate user ***/ - - #ifndef NO_SECURITY + + #ifndef NO_SECURITY user = GetPgUserName(); relation = RewriteGetRuleEventRel(rule); aclcheck = pg_aclcheck(relation, user, ACL_RU); @@ -453,7 +453,7 @@ void CommentRewrite(char *rule, char *comment) { #endif /*** Next, find the rule's oid ***/ - + rewritetuple = SearchSysCacheTuple(RULENAME, PointerGetDatum(rule), 0, 0, 0); if (!HeapTupleIsValid(rewritetuple)) { @@ -461,7 +461,7 @@ void CommentRewrite(char *rule, char *comment) { } oid = rewritetuple->t_data->t_oid; - + /*** Call CreateComments() to create/drop the comments ***/ CreateComments(oid, comment); @@ -473,7 +473,7 @@ void CommentRewrite(char *rule, char *comment) { * * This routine is used to add/drop any user-comments a user might * have regarding a TYPE. The type is specified by name - * and, if found, and the user has appropriate permissions, a + * and, if found, and the user has appropriate permissions, a * comment will be added/dropped using the CreateComments() routine. * The type's name and the comments are the paramters to this routine. *------------------------------------------------------------------ @@ -486,17 +486,17 @@ void CommentType(char *type, char *comment) { char *user; /*** First, validate user ***/ - - #ifndef NO_SECURITY + + #ifndef NO_SECURITY user = GetPgUserName(); - if (!pg_ownercheck(user, type, TYPENAME)) { + if (!pg_ownercheck(user, type, TYPENAME)) { elog(ERROR, "you are not permitted to comment on type '%s'", type); } #endif /*** Next, find the type's oid ***/ - + typetuple = SearchSysCacheTuple(TYPENAME, PointerGetDatum(type), 0, 0, 0); if (!HeapTupleIsValid(typetuple)) { @@ -504,7 +504,7 @@ void CommentType(char *type, char *comment) { } oid = typetuple->t_data->t_oid; - + /*** Call CreateComments() to create/drop the comments ***/ CreateComments(oid, comment); @@ -514,20 +514,20 @@ void CommentType(char *type, char *comment) { /*------------------------------------------------------------------ * CommentAggregate -- * - * This routine is used to allow a user to provide comments on an + * This routine is used to allow a user to provide comments on an * aggregate function. The aggregate function is determined by both - * its name and its argument type, which, with the comments are + * its name and its argument type, which, with the comments are * the three parameters handed to this routine. *------------------------------------------------------------------ */ void CommentAggregate(char *aggregate, char *argument, char *comment) { - + HeapTuple aggtuple; Oid baseoid, oid; bool defined; char *user; - + /*** First, attempt to determine the base aggregate oid ***/ if (argument) { @@ -538,7 +538,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) { } else { baseoid = 0; } - + /*** Next, validate the user's attempt to comment ***/ #ifndef NO_SECURITY @@ -566,9 +566,9 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) { elog(ERROR, "aggregate '%s' does not exist", aggregate); } } - + oid = aggtuple->t_data->t_oid; - + /*** Call CreateComments() to create/drop the comments ***/ CreateComments(oid, comment); @@ -578,9 +578,9 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) { /*------------------------------------------------------------------ * CommentProc -- * - * This routine is used to allow a user to provide comments on an + * This routine is used to allow a user to provide comments on an * procedure (function). The procedure is determined by both - * its name and its argument list. The argument list is expected to + * its name and its argument list. The argument list is expected to * be a series of parsed nodes pointed to by a List object. If the * comments string is empty, the associated comment is dropped. *------------------------------------------------------------------ @@ -589,7 +589,7 @@ void CommentAggregate(char *aggregate, char *argument, char *comment) { void CommentProc(char *function, List *arguments, char *comment) { HeapTuple argtuple, functuple; - Oid oid, argoids[8]; + Oid oid, argoids[FUNC_MAX_ARGS]; char *user, *argument; int i, argcount; @@ -597,7 +597,7 @@ void CommentProc(char *function, List *arguments, char *comment) { argcount = length(arguments); if (argcount > 0) { - MemSet(argoids, 0, 8 * sizeof(Oid)); + MemSet(argoids, 0, FUNC_MAX_ARGS * sizeof(Oid)); for (i = 0; i < argcount; i++) { argument = strVal(lfirst(arguments)); arguments = lnext(arguments); @@ -632,29 +632,29 @@ void CommentProc(char *function, List *arguments, char *comment) { PointerGetDatum(argoids), 0); /*** Deallocate our argument oids and check the function tuple ***/ - + if (!HeapTupleIsValid(functuple)) { elog(ERROR, "function '%s' with the supplied %s does not exist", function, "argument list"); } - + oid = functuple->t_data->t_oid; - + /*** Call CreateComments() to create/drop the comments ***/ CreateComments(oid, comment); } - + /*------------------------------------------------------------------ * CommentOperator -- * - * This routine is used to allow a user to provide comments on an + * This routine is used to allow a user to provide comments on an * operator. The operator for commenting is determined by both * its name and its argument list which defines the left and right - * hand types the operator will operate on. The argument list is - * expected to be a couple of parse nodes pointed to be a List - * object. If the comments string is empty, the associated comment + * hand types the operator will operate on. The argument list is + * expected to be a couple of parse nodes pointed to be a List + * object. If the comments string is empty, the associated comment * is dropped. *------------------------------------------------------------------ */ @@ -670,7 +670,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) { if (lfirst(arguments) != NULL) { lefttype = strVal(lfirst(arguments)); - } + } if (lsecond(arguments) != NULL) { righttype = strVal(lsecond(arguments)); } @@ -683,9 +683,9 @@ void CommentOperator(char *opername, List *arguments, char *comment) { elog(ERROR, "left type '%s' does not exist", lefttype); } } - + /*** Attempt to fetch the right oid, if specified ***/ - + if (righttype != NULL) { rightoid = TypeGet(righttype, &defined); if (!OidIsValid(rightoid)) { @@ -699,7 +699,7 @@ void CommentOperator(char *opername, List *arguments, char *comment) { else if (OidIsValid(leftoid)) oprtype = 'l'; else if (OidIsValid(rightoid)) oprtype = 'r'; else elog(ERROR, "operator '%s' is of an illegal type'", opername); - + /*** Attempt to fetch the operator oid ***/ optuple = SearchSysCacheTupleCopy(OPERNAME, PointerGetDatum(opername), @@ -710,8 +710,8 @@ void CommentOperator(char *opername, List *arguments, char *comment) { elog(ERROR, "operator '%s' does not exist", opername); } - oid = optuple->t_data->t_oid; - + oid = optuple->t_data->t_oid; + /*** Valid user's ability to comment on this operator ***/ #ifndef NO_SECURITY @@ -748,8 +748,8 @@ void CommentTrigger(char *trigger, char *relname, char *comment) { ScanKeyData entry; Oid oid = InvalidOid; char *user; - - /*** First, validate the user's action ***/ + + /*** First, validate the user's action ***/ #ifndef NO_SECURITY user = GetPgUserName(); @@ -761,10 +761,10 @@ void CommentTrigger(char *trigger, char *relname, char *comment) { /*** Now, fetch the trigger oid from pg_trigger ***/ - relation = heap_openr(relname, AccessShareLock); + relation = heap_openr(relname, AccessShareLock); pg_trigger = heap_openr(TriggerRelationName, AccessShareLock); ScanKeyEntryInitialize(&entry, 0, Anum_pg_trigger_tgrelid, - F_OIDEQ, RelationGetRelid(relation)); + F_OIDEQ, RelationGetRelid(relation)); scan = heap_beginscan(pg_trigger, 0, SnapshotNow, 1, &entry); triggertuple = heap_getnext(scan, 0); while (HeapTupleIsValid(triggertuple)) { @@ -784,11 +784,11 @@ void CommentTrigger(char *trigger, char *relname, char *comment) { } /*** Create the comments with the pg_trigger oid ***/ - + CreateComments(oid, comment); - + /*** Complete the scan and close any opened relations ***/ - + heap_endscan(scan); heap_close(pg_trigger, AccessShareLock); heap_close(relation, AccessShareLock); diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index e4607d93a5..0682cefecb 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.16 1999/12/16 22:19:41 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.17 2000/01/10 17:14:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -414,7 +414,7 @@ FuncIndexArgs(IndexElem *funcIndex, } *opOidP = tuple->t_data->t_oid; - MemSet(argTypes, 0, 8 * sizeof(Oid)); + MemSet(argTypes, 0, FUNC_MAX_ARGS * sizeof(Oid)); /* * process the function arguments diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c index 718e06dee4..47d2201c82 100644 --- a/src/backend/commands/proclang.c +++ b/src/backend/commands/proclang.c @@ -50,7 +50,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) HeapTuple langTup; HeapTuple procTup; - Oid typev[8]; + Oid typev[FUNC_MAX_ARGS]; char nulls[Natts_pg_language]; Datum values[Natts_pg_language]; Relation rel; @@ -136,7 +136,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt) CatalogIndexInsert(idescs, Num_pg_language_indices, rel, tup); CatalogCloseIndices(Num_pg_language_indices, idescs); } - + heap_close(rel, RowExclusiveLock); } diff --git a/src/backend/commands/remove.c b/src/backend/commands/remove.c index 07b552dedd..4a327fde28 100644 --- a/src/backend/commands/remove.c +++ b/src/backend/commands/remove.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.42 1999/12/16 22:19:41 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.43 2000/01/10 17:14:32 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -163,7 +163,7 @@ SingleOpOperatorRemove(Oid typeOid) DeleteComments(tup->t_data->t_oid); heap_delete(rel, &tup->t_self, NULL); - + } heap_endscan(scan); @@ -315,13 +315,13 @@ RemoveFunction(char *functionName, /* function name to be removed */ { Relation relation; HeapTuple tup; - Oid argList[8]; + Oid argList[FUNC_MAX_ARGS]; char *userName; char *typename; int i; - MemSet(argList, 0, 8 * sizeof(Oid)); + MemSet(argList, 0, FUNC_MAX_ARGS * sizeof(Oid)); for (i = 0; i < nargs; i++) { typename = strVal(lfirst(argNameList)); @@ -444,7 +444,7 @@ RemoveAggregate(char *aggName, char *aggType) aggName); } } - + /*** Remove any comments related to this aggregate ***/ DeleteComments(tup->t_data->t_oid); diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c index b0196c90de..c8dfd504e7 100644 --- a/src/backend/commands/trigger.c +++ b/src/backend/commands/trigger.c @@ -41,7 +41,7 @@ void CreateTrigger(CreateTrigStmt *stmt) { int16 tgtype; - int16 tgattr[8] = {0}; + int16 tgattr[FUNC_MAX_ARGS] = {0}; Datum values[Natts_pg_trigger]; char nulls[Natts_pg_trigger]; Relation rel; @@ -53,7 +53,7 @@ CreateTrigger(CreateTrigStmt *stmt) Relation idescs[Num_pg_trigger_indices]; Relation ridescs[Num_pg_class_indices]; MemoryContext oldcxt; - Oid fargtypes[8]; + Oid fargtypes[FUNC_MAX_ARGS]; int found = 0; int i; char constrtrigname[NAMEDATALEN]; @@ -144,7 +144,7 @@ CreateTrigger(CreateTrigStmt *stmt) } heap_endscan(tgscan); - MemSet(fargtypes, 0, 8 * sizeof(Oid)); + MemSet(fargtypes, 0, FUNC_MAX_ARGS * sizeof(Oid)); tuple = SearchSysCacheTuple(PROCNAME, PointerGetDatum(stmt->funcname), Int32GetDatum(0), @@ -306,7 +306,7 @@ DropTrigger(DropTrigStmt *stmt) heap_delete(tgrel, &tuple->t_self, NULL); tgfound++; - + } else found++; @@ -368,7 +368,7 @@ RelationRemoveTriggers(Relation rel) /*** Delete any comments associated with this trigger ***/ DeleteComments(tup->t_data->t_oid); - + heap_delete(tgrel, &tup->t_self, NULL); } @@ -473,7 +473,7 @@ RelationBuildTriggers(Relation relation) build->tgdeferrable = pg_trigger->tgdeferrable; build->tginitdeferred = pg_trigger->tginitdeferred; build->tgnargs = pg_trigger->tgnargs; - memcpy(build->tgattr, &(pg_trigger->tgattr), 8 * sizeof(int16)); + memcpy(build->tgattr, &(pg_trigger->tgattr), FUNC_MAX_ARGS * sizeof(int16)); val = (struct varlena *) fastgetattr(&tuple, Anum_pg_trigger_tgargs, tgrel->rd_att, &isnull); @@ -992,7 +992,7 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate) trigstate = (DeferredTriggerStatus) palloc(sizeof(DeferredTriggerStatusData)); trigstate->dts_tgoid = tgoid; - trigstate->dts_tgisdeferred = + trigstate->dts_tgisdeferred = ((itemstate & TRIGGER_DEFERRED_INITDEFERRED) != 0); deftrig_trigstates = lappend(deftrig_trigstates, trigstate); @@ -1008,7 +1008,7 @@ deferredTriggerCheckState(Oid tgoid, int32 itemstate) * Add a new trigger event to the queue. * ---------- */ -static void +static void deferredTriggerAddEvent(DeferredTriggerEvent event) { deftrig_events = lappend(deftrig_events, event); @@ -1040,14 +1040,14 @@ deferredTriggerGetPreviousEvent(Oid relid, ItemPointer ctid) if (previous->dte_event & TRIGGER_DEFERRED_CANCELED) continue; - if (ItemPointerGetBlockNumber(ctid) == + if (ItemPointerGetBlockNumber(ctid) == ItemPointerGetBlockNumber(&(previous->dte_newctid)) && ItemPointerGetOffsetNumber(ctid) == ItemPointerGetOffsetNumber(&(previous->dte_newctid))) return previous; } - elog(ERROR, + elog(ERROR, "deferredTriggerGetPreviousEvent(): event for tuple %s not found", tidout(ctid)); return NULL; @@ -1107,26 +1107,26 @@ deferredTriggerExecute(DeferredTriggerEvent event, int itemno) case TRIGGER_EVENT_INSERT: SaveTriggerData.tg_trigtuple = &newtuple; SaveTriggerData.tg_newtuple = NULL; - SaveTriggerData.tg_trigger = + SaveTriggerData.tg_trigger = rel->trigdesc->tg_after_row[TRIGGER_EVENT_INSERT][itemno]; break; case TRIGGER_EVENT_UPDATE: SaveTriggerData.tg_trigtuple = &oldtuple; SaveTriggerData.tg_newtuple = &newtuple; - SaveTriggerData.tg_trigger = + SaveTriggerData.tg_trigger = rel->trigdesc->tg_after_row[TRIGGER_EVENT_UPDATE][itemno]; break; case TRIGGER_EVENT_DELETE: SaveTriggerData.tg_trigtuple = &oldtuple; SaveTriggerData.tg_newtuple = NULL; - SaveTriggerData.tg_trigger = + SaveTriggerData.tg_trigger = rel->trigdesc->tg_after_row[TRIGGER_EVENT_DELETE][itemno]; break; default: - } + } /* ---------- * Call the trigger and throw away an eventually returned @@ -1195,10 +1195,10 @@ deferredTriggerInvokeEvents(bool immediate_only) * ---------- */ event = (DeferredTriggerEvent) lfirst(el); - if (event->dte_event & (TRIGGER_DEFERRED_DONE | + if (event->dte_event & (TRIGGER_DEFERRED_DONE | TRIGGER_DEFERRED_CANCELED)) continue; - + /* ---------- * Check each trigger item in the event. * ---------- @@ -1215,7 +1215,7 @@ deferredTriggerInvokeEvents(bool immediate_only) * ---------- */ if (immediate_only && deferredTriggerCheckState( - event->dte_item[i].dti_tgoid, + event->dte_item[i].dti_tgoid, event->dte_item[i].dti_state)) { still_deferred_ones = true; @@ -1273,7 +1273,7 @@ DeferredTriggerBeginXact(void) DeferredTriggerStatus stat; if (deftrig_cxt != NULL) - elog(FATAL, + elog(FATAL, "DeferredTriggerBeginXact() called while inside transaction"); /* ---------- @@ -1286,12 +1286,12 @@ DeferredTriggerBeginXact(void) deftrig_all_isset = deftrig_dfl_all_isset; deftrig_all_isdeferred = deftrig_dfl_all_isdeferred; - + deftrig_trigstates = NIL; foreach (l, deftrig_dfl_trigstates) { dflstat = (DeferredTriggerStatus) lfirst(l); - stat = (DeferredTriggerStatus) + stat = (DeferredTriggerStatus) palloc(sizeof(DeferredTriggerStatusData)); stat->dts_tgoid = dflstat->dts_tgoid; @@ -1530,7 +1530,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt) */ pg_trigger = (Form_pg_trigger) GETSTRUCT(&tuple); if (stmt->deferred & !pg_trigger->tgdeferrable) - elog(ERROR, "Constraint '%s' is not deferrable", + elog(ERROR, "Constraint '%s' is not deferrable", (char *)lfirst(l)); constr_oid = tuple.t_data->t_oid; @@ -1582,7 +1582,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt) state->dts_tgoid = (Oid) lfirst(l); state->dts_tgisdeferred = stmt->deferred; - deftrig_dfl_trigstates = + deftrig_dfl_trigstates = lappend(deftrig_dfl_trigstates, state); } } @@ -1618,7 +1618,7 @@ DeferredTriggerSetState(ConstraintsSetStmt *stmt) state->dts_tgoid = (Oid) lfirst(l); state->dts_tgisdeferred = stmt->deferred; - deftrig_trigstates = + deftrig_trigstates = lappend(deftrig_trigstates, state); } } @@ -1652,7 +1652,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, TriggerData SaveTriggerData; if (deftrig_cxt == NULL) - elog(ERROR, + elog(ERROR, "DeferredTriggerSaveEvent() called outside of transaction"); /* ---------- @@ -1681,7 +1681,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, ItemPointerSetInvalid(&(newctid)); /* ---------- - * Create a new event + * Create a new event * ---------- */ oldcxt = MemoryContextSwitchTo((MemoryContext) deftrig_cxt); @@ -1691,7 +1691,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, new_size = sizeof(DeferredTriggerEventData) + ntriggers * sizeof(DeferredTriggerEventItem); - + new_event = (DeferredTriggerEvent) palloc(new_size); new_event->dte_event = event & TRIGGER_EVENT_OPMASK; new_event->dte_relid = rel->rd_id; @@ -1702,10 +1702,10 @@ DeferredTriggerSaveEvent(Relation rel, int event, for (i = 0; i < ntriggers; i++) { new_event->dte_item[i].dti_tgoid = triggers[i]->tgoid; - new_event->dte_item[i].dti_state = - ((triggers[i]->tgdeferrable) ? + new_event->dte_item[i].dti_state = + ((triggers[i]->tgdeferrable) ? TRIGGER_DEFERRED_DEFERRABLE : 0) | - ((triggers[i]->tginitdeferred) ? + ((triggers[i]->tginitdeferred) ? TRIGGER_DEFERRED_INITDEFERRED : 0) | ((rel->trigdesc->n_before_row[event] > 0) ? TRIGGER_DEFERRED_HAS_BEFORE : 0); @@ -1729,7 +1729,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, if (oldtup->t_data->t_xmin != GetCurrentTransactionId()) prev_event = NULL; else - prev_event = + prev_event = deferredTriggerGetPreviousEvent(rel->rd_id, &oldctid); /* ---------- @@ -1759,7 +1759,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, case F_RI_FKEY_SETDEFAULT_UPD: is_ri_trigger = true; break; - + default: is_ri_trigger = false; break; @@ -1776,7 +1776,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, CurrentTriggerData = &SaveTriggerData; key_unchanged = RI_FKey_keyequal_upd(); CurrentTriggerData = NULL; - + if (key_unchanged) { /* ---------- @@ -1789,7 +1789,7 @@ DeferredTriggerSaveEvent(Relation rel, int event, if (prev_event) { - if (prev_event->dte_event & + if (prev_event->dte_event & TRIGGER_DEFERRED_ROW_INSERTED) { /* ---------- @@ -1797,9 +1797,9 @@ DeferredTriggerSaveEvent(Relation rel, int event, * So any key value is considered changed. * ---------- */ - new_event->dte_event |= + new_event->dte_event |= TRIGGER_DEFERRED_ROW_INSERTED; - new_event->dte_event |= + new_event->dte_event |= TRIGGER_DEFERRED_KEY_CHANGED; new_event->dte_item[i].dti_state |= TRIGGER_DEFERRED_KEY_CHANGED; diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c index 80910db114..bd54659773 100644 --- a/src/backend/executor/execQual.c +++ b/src/backend/executor/execQual.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.64 1999/11/12 06:39:34 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.65 2000/01/10 17:14:34 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -656,7 +656,7 @@ ExecMakeFunctionResult(Node *node, bool *isNull, bool *isDone) { - Datum argV[MAXFMGRARGS]; + Datum argV[FUNC_MAX_ARGS]; FunctionCachePtr fcache; Func *funcNode = NULL; Oper *operNode = NULL; @@ -690,7 +690,7 @@ ExecMakeFunctionResult(Node *node, { bool argDone; - if (fcache->nargs > MAXFMGRARGS) + if (fcache->nargs > FUNC_MAX_ARGS) elog(ERROR, "ExecMakeFunctionResult: too many arguments"); /* diff --git a/src/backend/libpq/be-pqexec.c b/src/backend/libpq/be-pqexec.c index 22d1085276..00b7aca8de 100644 --- a/src/backend/libpq/be-pqexec.c +++ b/src/backend/libpq/be-pqexec.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.25 2000/01/05 18:23:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/Attic/be-pqexec.c,v 1.26 2000/01/10 17:14:35 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -57,7 +57,7 @@ PQfn(int fnid, int nargs) { char *retval; /* XXX - should be datum, maybe ? */ - char *arg[8]; + char *arg[FUNC_MAX_ARGS]; int i; /* ---------------- @@ -304,8 +304,8 @@ pqtest_PQfn(char *q) v, f, offsets; - char *fields[8]; - PQArgBlock pqargs[7]; + char *fields[FUNC_MAX_ARGS]; + PQArgBlock pqargs[FUNC_MAX_ARGS]; int res; char *pqres; @@ -313,7 +313,7 @@ pqtest_PQfn(char *q) * parse q into fields * ---------------- */ - i = strparse(q, fields, &offsets, 8); + i = strparse(q, fields, &offsets, FUNC_MAX_ARGS); printf("pqtest_PQfn: strparse returns %d fields\n", i); /* debug */ if (i == 0) return -1; @@ -331,7 +331,7 @@ pqtest_PQfn(char *q) * build a PQArgBlock * ---------------- */ - for (j = 1; j < i && j < 8; j++) + for (j = 1; j < i && j < FUNC_MAX_ARGS; j++) { k = j - 1; v = atoi(fields[j]); diff --git a/src/backend/parser/parse_coerce.c b/src/backend/parser/parse_coerce.c index 95315d6c82..6ddc090bb0 100644 --- a/src/backend/parser/parse_coerce.c +++ b/src/backend/parser/parse_coerce.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.26 1999/12/10 07:37:35 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.27 2000/01/10 17:14:36 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -142,7 +142,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids) HeapTuple ftup; int i; Type tp; - Oid oid_array[MAXFARGS]; + Oid oid_array[FUNC_MAX_ARGS]; /* run through argument list... */ for (i = 0; i < nargs; i++) @@ -170,7 +170,7 @@ can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids) */ else if (input_typeids[i] != UNKNOWNOID) { - MemSet(oid_array, 0, MAXFARGS * sizeof(Oid)); + MemSet(oid_array, 0, FUNC_MAX_ARGS * sizeof(Oid)); oid_array[0] = input_typeids[i]; /* diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 2a19723784..1f63f6bc66 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.65 1999/12/16 22:19:48 wieck Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.66 2000/01/10 17:14:36 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -236,7 +236,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, Oid relid; int nargs = length(fargs); Func *funcnode; - Oid oid_array[MAXFARGS]; + Oid oid_array[FUNC_MAX_ARGS]; Oid *true_oid_array; Node *retval; bool retset; @@ -435,7 +435,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, * transform relation name arguments into varnodes of the appropriate * form. */ - MemSet(oid_array, 0, MAXFARGS * sizeof(Oid)); + MemSet(oid_array, 0, FUNC_MAX_ARGS * sizeof(Oid)); nargs = 0; foreach(i, fargs) @@ -463,7 +463,7 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, refname); #endif } - + relname = rte->relname; vnum = refnameRangeTablePosn(pstate, rte->refname, NULL); @@ -496,12 +496,12 @@ ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs, } /* Most of the rest of the parser just assumes that functions do not - * have more than MAXFARGS parameters. We have to test here to protect + * have more than FUNC_MAX_ARGS parameters. We have to test here to protect * against array overruns, etc. */ - if (nargs >= MAXFARGS) + if (nargs >= FUNC_MAX_ARGS) elog(ERROR, "Cannot pass more than %d arguments to a function", - MAXFARGS); + FUNC_MAX_ARGS); oid_array[nargs++] = toid; } @@ -710,8 +710,8 @@ func_get_candidates(char *funcname, int nargs) current_candidate = (CandidateList) palloc(sizeof(struct _CandidateList)); current_candidate->args = (Oid *) - palloc(MAXFARGS * sizeof(Oid)); - MemSet(current_candidate->args, 0, MAXFARGS * sizeof(Oid)); + palloc(FUNC_MAX_ARGS * sizeof(Oid)); + MemSet(current_candidate->args, 0, FUNC_MAX_ARGS * sizeof(Oid)); for (i = 0; i < nargs; i++) current_candidate->args[i] = pgProcP->proargtypes[i]; @@ -1067,9 +1067,9 @@ argtype_inherit(int nargs, Oid *oid_array) { Oid relid; int i; - InhPaths arginh[MAXFARGS]; + InhPaths arginh[FUNC_MAX_ARGS]; - for (i = 0; i < MAXFARGS; i++) + for (i = 0; i < FUNC_MAX_ARGS; i++) { if (i < nargs) { @@ -1203,7 +1203,7 @@ gen_cross_product(InhPaths *arginh, int nargs) Oid *oneres; int i, j; - int cur[MAXFARGS]; + int cur[FUNC_MAX_ARGS]; nanswers = 1; for (i = 0; i < nargs; i++) @@ -1217,8 +1217,8 @@ gen_cross_product(InhPaths *arginh, int nargs) /* compute the cross product from right to left */ for (;;) { - oneres = (Oid *) palloc(MAXFARGS * sizeof(Oid)); - MemSet(oneres, 0, MAXFARGS * sizeof(Oid)); + oneres = (Oid *) palloc(FUNC_MAX_ARGS * sizeof(Oid)); + MemSet(oneres, 0, FUNC_MAX_ARGS * sizeof(Oid)); for (i = nargs - 1; i >= 0 && cur[i] > arginh[i].nsupers; i--) continue; @@ -1508,7 +1508,7 @@ ParseComplexProjection(ParseState *pstate, void func_error(char *caller, char *funcname, int nargs, Oid *argtypes, char *msg) { - char p[(NAMEDATALEN + 2) * MAXFMGRARGS], + char p[(NAMEDATALEN + 2) * FUNC_MAX_ARGS], *ptr; int i; diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c index a5e130b854..503f544e9e 100644 --- a/src/backend/parser/parse_target.c +++ b/src/backend/parser/parse_target.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.50 1999/12/10 07:37:35 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.51 2000/01/10 17:14:36 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -318,14 +318,14 @@ SizeTargetExpr(ParseState *pstate, int32 attrtypmod) { char *funcname; - Oid oid_array[MAXFARGS]; + Oid oid_array[FUNC_MAX_ARGS]; HeapTuple ftup; int i; funcname = typeidTypeName(attrtype); oid_array[0] = attrtype; oid_array[1] = INT4OID; - for (i = 2; i < MAXFARGS; i++) + for (i = 2; i < FUNC_MAX_ARGS; i++) oid_array[i] = InvalidOid; /* attempt to find with arguments exactly as specified... */ diff --git a/src/backend/tcop/fastpath.c b/src/backend/tcop/fastpath.c index 8a921ac906..95c1ccbafc 100644 --- a/src/backend/tcop/fastpath.c +++ b/src/backend/tcop/fastpath.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.32 2000/01/10 16:13:13 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/tcop/fastpath.c,v 1.33 2000/01/10 17:14:37 momjian Exp $ * * NOTES * This cruft is the server side of PQfn. @@ -116,7 +116,7 @@ SendFunctionResult(Oid fid, /* function id */ /* * This structure saves enough state so that one can avoid having to * do catalog lookups over and over again. (Each RPC can require up - * to MAXFMGRARGS+2 lookups, which is quite tedious.) + * to FUNC_MAX_ARGS+2 lookups, which is quite tedious.) * * The previous incarnation of this code just assumed that any argument * of size <= 4 was by value; this is not correct. There is no cheap @@ -127,8 +127,8 @@ struct fp_info { Oid funcid; int nargs; - bool argbyval[MAXFMGRARGS]; - int32 arglen[MAXFMGRARGS]; /* signed (for varlena) */ + bool argbyval[FUNC_MAX_ARGS]; + int32 arglen[FUNC_MAX_ARGS]; /* signed (for varlena) */ bool retbyval; int32 retlen; /* signed (for varlena) */ TransactionId xid; @@ -278,7 +278,7 @@ HandleFunctionRequest() int argsize; int nargs; int tmp; - char *arg[8]; + char *arg[FUNC_MAX_ARGS]; char *retval; int i; uint32 palloced; @@ -317,7 +317,7 @@ HandleFunctionRequest() * need to remember, so that we pfree() it after the call. */ palloced = 0x0; - for (i = 0; i < 8; ++i) + for (i = 0; i < FUNC_MAX_ARGS; ++i) { if (i >= nargs) arg[i] = (char *) NULL; diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c index d15c7a4393..faeb380441 100644 --- a/src/backend/utils/adt/regproc.c +++ b/src/backend/utils/adt/regproc.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.48 2000/01/10 16:13:14 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.49 2000/01/10 17:14:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -238,7 +238,6 @@ oidvectortypes(Oid *oidArray) HeapTuple typetup; text *result; int num; - Oid *sp; if (oidArray == NULL) { @@ -247,16 +246,16 @@ oidvectortypes(Oid *oidArray) return result; } - result = (text *) palloc(NAMEDATALEN * 8 + 8 + VARHDRSZ); + result = (text *) palloc(NAMEDATALEN * FUNC_MAX_ARGS + + FUNC_MAX_ARGS + VARHDRSZ); *VARDATA(result) = '\0'; - sp = oidArray; - for (num = 8; num != 0; num--, sp++) + for (num = 0; num < FUNC_MAX_ARGS; num++) { - if (*sp != InvalidOid) + if (oidArray[num] != InvalidOid) { typetup = SearchSysCacheTuple(TYPEOID, - ObjectIdGetDatum(*sp), + ObjectIdGetDatum(oidArray[num]), 0, 0, 0); if (HeapTupleIsValid(typetup)) { diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c index 3424155dfb..5755926e9d 100644 --- a/src/backend/utils/adt/selfuncs.c +++ b/src/backend/utils/adt/selfuncs.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.45 2000/01/09 00:26:20 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.46 2000/01/10 17:14:38 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -253,7 +253,7 @@ intltsel(Oid opid, rtype = ((Form_pg_operator) GETSTRUCT(oprtuple))->oprright; /* Convert the constant to a uniform comparison scale. */ - if (! convert_to_scale(value, + if (! convert_to_scale(value, ((flag & SEL_RIGHT) ? rtype : ltype), &val)) { @@ -310,7 +310,7 @@ intltsel(Oid opid, * stats are out of date and return a default... */ *result = DEFAULT_INEQ_SEL; - } + } else if (val <= low || val >= high) { /* If given value is outside the statistical range, return a @@ -512,10 +512,10 @@ convert_to_scale(Datum value, Oid typid, /* See whether there is a registered type-conversion function, * namely a procedure named "float8" with the right signature. */ - Oid oid_array[MAXFARGS]; + Oid oid_array[FUNC_MAX_ARGS]; HeapTuple ftup; - MemSet(oid_array, 0, MAXFARGS * sizeof(Oid)); + MemSet(oid_array, 0, FUNC_MAX_ARGS * sizeof(Oid)); oid_array[0] = typid; ftup = SearchSysCacheTuple(PROCNAME, PointerGetDatum("float8"), diff --git a/src/backend/utils/fmgr/fmgr.c b/src/backend/utils/fmgr/fmgr.c index 6506f4a519..4dd03f0267 100644 --- a/src/backend/utils/fmgr/fmgr.c +++ b/src/backend/utils/fmgr/fmgr.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.33 1999/11/22 17:56:33 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/fmgr/fmgr.c,v 1.34 2000/01/10 17:14:39 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -44,9 +44,9 @@ fmgr_pl(char *arg0,...) values.data[0] = arg0; if (n_arguments > 1) { - if (n_arguments > MAXFMGRARGS) + if (n_arguments > FUNC_MAX_ARGS) elog(ERROR, "fmgr_pl: function %u: too many arguments (%d > %d)", - fmgr_pl_finfo->fn_oid, n_arguments, MAXFMGRARGS); + fmgr_pl_finfo->fn_oid, n_arguments, FUNC_MAX_ARGS); va_start(pvar, arg0); for (i = 1; i < n_arguments; i++) values.data[i] = va_arg(pvar, char *); @@ -165,22 +165,93 @@ fmgr_c(FmgrInfo *finfo, values->data[6], values->data[7]); break; case 9: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8]); + break; + case 10: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9]); + break; + case 11: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9], + values->data[10]); + break; + case 12: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9], + values->data[10], values->data[11]); + break; + case 13: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9], + values->data[10], values->data[11], + values->data[12]); + break; + case 14: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9], + values->data[10], values->data[11], + values->data[12], values->data[13]); + break; + case 15: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9], + values->data[10], values->data[11], + values->data[12], values->data[13], + values->data[14]); + break; + case 16: + returnValue = (*user_fn) (values->data[0], values->data[1], + values->data[2], values->data[3], + values->data[4], values->data[5], + values->data[6], values->data[7], + values->data[8], values->data[9], + values->data[10], values->data[11], + values->data[12], values->data[13], + values->data[14], values->data[15]); + break; + case 17: /* - * XXX Note that functions with >8 arguments can only be + * XXX Note that functions with >FUNC_MAX_ARGS arguments can only be * called from inside the system, not from the user level, - * since the catalogs only store 8 argument types for user + * since the catalogs only store FUNC_MAX_ARGS argument types for user * type-checking! */ returnValue = (*user_fn) (values->data[0], values->data[1], values->data[2], values->data[3], values->data[4], values->data[5], values->data[6], values->data[7], - values->data[8]); + values->data[8], values->data[9], + values->data[10], values->data[11], + values->data[12], values->data[13], + values->data[14], values->data[15]); break; default: elog(ERROR, "fmgr_c: function %u: too many arguments (%d > %d)", - finfo->fn_oid, n_arguments, MAXFMGRARGS); + finfo->fn_oid, n_arguments, FUNC_MAX_ARGS); break; } return returnValue; @@ -323,9 +394,9 @@ fmgr(Oid procedureId,...) fmgr_info(procedureId, &finfo); pronargs = finfo.fn_nargs; - if (pronargs > MAXFMGRARGS) + if (pronargs > FUNC_MAX_ARGS) elog(ERROR, "fmgr: function %u: too many arguments (%d > %d)", - procedureId, pronargs, MAXFMGRARGS); + procedureId, pronargs, FUNC_MAX_ARGS); va_start(pvar, procedureId); for (i = 0; i < pronargs; ++i) @@ -364,10 +435,10 @@ fmgr_ptr(FmgrInfo *finfo,...) va_start(pvar, finfo); n_arguments = va_arg(pvar, int); local_finfo->fn_nargs = n_arguments; - if (n_arguments > MAXFMGRARGS) + if (n_arguments > FUNC_MAX_ARGS) { elog(ERROR, "fmgr_ptr: function %u: too many arguments (%d > %d)", - func_id, n_arguments, MAXFMGRARGS); + func_id, n_arguments, FUNC_MAX_ARGS); } for (i = 0; i < n_arguments; ++i) values.data[i] = va_arg(pvar, char *); diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 3bfe2f0ab6..60ed1e8704 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -21,7 +21,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.130 2000/01/10 16:13:16 momjian Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.131 2000/01/10 17:14:40 momjian Exp $ * * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * @@ -129,7 +129,7 @@ usage(const char *progname) #ifdef HAVE_GETOPT_LONG fprintf(stderr, - + " -a, --data-only dump out only the data, no schema\n" " -c, --clean clean(drop) schema prior to create\n" " -d, --insert-proper dump data as proper insert strings\n" @@ -146,11 +146,11 @@ usage(const char *progname) " -v, --verbose verbose\n" " -x, --no-acl do not dump ACL's (grant/revoke)\n" " -?, --help show this help message\n" - + ); /* fprintf */ #else fprintf(stderr, - + " -a dump out only the data, no schema\n" " -c clean(drop) schema prior to create\n" " -d dump data as proper insert strings\n" @@ -167,10 +167,10 @@ usage(const char *progname) " -v verbose\n" " -x do not dump ACL's (grant/revoke)\n" " -? show this help message\n" - + ); /* fprintf */ #endif - + fprintf(stderr, "\nIf dbname is not supplied, then the DATABASE environment variable value is used.\n\n"); @@ -566,7 +566,7 @@ main(int argc, char **argv) {"verbose", no_argument, NULL, 'v'}, {"no-acl", no_argument, NULL, 'x'}, {"help", no_argument, NULL, '?'}, - }; + }; int optindex; #endif @@ -667,7 +667,7 @@ main(int argc, char **argv) "%s: The -z option(dump ACLs) is now the default, continuing.\n", progname); break; - case '?': + case '?': default: usage(progname); break; @@ -681,7 +681,7 @@ main(int argc, char **argv) progname); exit(2); } - + /* open the output file */ if (filename == NULL) g_fout = stdout; @@ -1069,7 +1069,7 @@ clearFuncInfo(FuncInfo *fun, int numFuncs) free(fun[i].proname); if (fun[i].usename) free(fun[i].usename); - for (a = 0; a < 8; ++a) + for (a = 0; a < FUNC_MAX_ARGS ; ++a) if (fun[i].argtypes[a]) free(fun[i].argtypes[a]); if (fun[i].prorettype) @@ -1122,8 +1122,8 @@ clearTableInfo(TableInfo *tblinfo, int numTables) free(tblinfo[i].typnames); if (tblinfo[i].notnull) free(tblinfo[i].notnull); - if (tblinfo[i].primary_key) - free(tblinfo[i].primary_key); + if (tblinfo[i].primary_key) + free(tblinfo[i].primary_key); } free(tblinfo); } @@ -1611,48 +1611,48 @@ getTables(int *numTables, FuncInfo *finfo, int numFuncs) else tblinfo[i].check_expr = NULL; - /* Get primary key */ - if (strcmp(PQgetvalue(res, i, i_relhasindex), "t")==0) - { - PGresult * res2; - char str[INDEX_MAX_KEYS * NAMEDATALEN + 3] = ""; - int j; + /* Get primary key */ + if (strcmp(PQgetvalue(res, i, i_relhasindex), "t")==0) + { + PGresult * res2; + char str[INDEX_MAX_KEYS * NAMEDATALEN + 3] = ""; + int j; resetPQExpBuffer(query); appendPQExpBuffer(query, - "SELECT a.attname " - "FROM pg_index i, pg_class c, pg_attribute a " - "WHERE i.indisprimary AND i.indrelid = %s " - " AND i.indexrelid = c.oid AND a.attnum > 0 AND a.attrelid = c.oid " - "ORDER BY a.attnum ", - tblinfo[i].oid); - res2 = PQexec(g_conn, query->data); + "SELECT a.attname " + "FROM pg_index i, pg_class c, pg_attribute a " + "WHERE i.indisprimary AND i.indrelid = %s " + " AND i.indexrelid = c.oid AND a.attnum > 0 AND a.attrelid = c.oid " + "ORDER BY a.attnum ", + tblinfo[i].oid); + res2 = PQexec(g_conn, query->data); if (!res2 || PQresultStatus(res2) != PGRES_TUPLES_OK) { fprintf(stderr, "getTables(): SELECT (for PRIMARY KEY) failed. Explanation from backend: %s", - PQerrorMessage(g_conn)); + PQerrorMessage(g_conn)); exit_nicely(g_conn); } - - for (j = 0; j < PQntuples(res2); j++) - { - if (strlen(str)>0) - strcat(str, ", "); - strcat(str, fmtId(PQgetvalue(res2, j, 0), force_quotes)); - } - - if (strlen(str)>0) { - tblinfo[i].primary_key = strdup(str); - if (tblinfo[i].primary_key == NULL) { - perror("strdup"); - exit(1); - } - } - else - tblinfo[i].primary_key = NULL; - } - else - tblinfo[i].primary_key = NULL; + + for (j = 0; j < PQntuples(res2); j++) + { + if (strlen(str)>0) + strcat(str, ", "); + strcat(str, fmtId(PQgetvalue(res2, j, 0), force_quotes)); + } + + if (strlen(str)>0) { + tblinfo[i].primary_key = strdup(str); + if (tblinfo[i].primary_key == NULL) { + perror("strdup"); + exit(1); + } + } + else + tblinfo[i].primary_key = NULL; + } + else + tblinfo[i].primary_key = NULL; /* Get Triggers */ if (tblinfo[i].ntrig > 0) @@ -2022,7 +2022,7 @@ getIndices(int *numIndices) */ appendPQExpBuffer(query, - "SELECT t1.relname as indexrelname, t2.relname as indrelname, " + "SELECT t1.relname as indexrelname, t2.relname as indrelname, " "i.indproc, i.indkey, i.indclass, " "a.amname as indamname, i.indisunique " "from pg_index i, pg_class t1, pg_class t2, pg_am a " @@ -2849,14 +2849,14 @@ dumpTables(FILE *fout, TableInfo *tblinfo, int numTables, tblinfo[i].check_expr[k]); } - /* PRIMARY KEY */ - if (tblinfo[i].primary_key) { - if (actual_atts + tblinfo[i].ncheck > 0) - appendPQExpBuffer(q, ",\n\t"); - appendPQExpBuffer(q, "PRIMARY KEY (%s)", tblinfo[i].primary_key); - } + /* PRIMARY KEY */ + if (tblinfo[i].primary_key) { + if (actual_atts + tblinfo[i].ncheck > 0) + appendPQExpBuffer(q, ",\n\t"); + appendPQExpBuffer(q, "PRIMARY KEY (%s)", tblinfo[i].primary_key); + } - appendPQExpBuffer(q, "\n)"); + appendPQExpBuffer(q, "\n)"); if (numParents > 0) { diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index b34d4b9642..cd06288500 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -5,7 +5,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_dump.h,v 1.43 1999/12/27 15:42:44 momjian Exp $ + * $Id: pg_dump.h,v 1.44 2000/01/10 17:14:40 momjian Exp $ * * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * @@ -61,7 +61,7 @@ typedef struct _funcInfo char *proowner; int lang; int nargs; - char *argtypes[8]; /* should be derived from obj/fmgr.h + char *argtypes[FUNC_MAX_ARGS]; /* should be derived from obj/fmgr.h * instead of hardwired */ char *prorettype; int retset; /* 1 if the function returns a set, 0 diff --git a/src/include/access/funcindex.h b/src/include/access/funcindex.h index cfa54d81fe..7106d1c194 100644 --- a/src/include/access/funcindex.h +++ b/src/include/access/funcindex.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: funcindex.h,v 1.7 1999/02/13 23:20:50 momjian Exp $ + * $Id: funcindex.h,v 1.8 2000/01/10 17:14:42 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -16,7 +16,7 @@ typedef struct { int nargs; - Oid arglist[8]; + Oid arglist[FUNC_MAX_ARGS]; Oid procOid; NameData funcName; } FuncIndexInfo; diff --git a/src/include/config.h.in b/src/include/config.h.in index c5a55a5fb3..c731bea442 100644 --- a/src/include/config.h.in +++ b/src/include/config.h.in @@ -93,9 +93,11 @@ #define INDEXSCAN_PATCH /* - * Maximum number of columns in an index. + * Maximum number of columns in an index and maximum number of args + * to a function. They must be the same value. */ #define INDEX_MAX_KEYS 8 +#define FUNC_MAX_ARGS INDEX_MAX_KEYS /* * Enables debugging print statements in the date/time support routines. diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index 04b9c44ec0..73262d4337 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: parse_func.h,v 1.20 1999/12/10 07:37:33 tgl Exp $ + * $Id: parse_func.h,v 1.21 2000/01/10 17:14:43 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -15,9 +15,6 @@ #include "parser/parse_node.h" - -#define MAXFARGS 8 /* max # args to a c or postquel function */ - /* * This structure is used to explore the inheritance hierarchy above * nodes in the type tree in order to disambiguate among polymorphic diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 689d5d0295..84bbe0950e 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: rel.h,v 1.30 1999/11/16 04:14:03 momjian Exp $ + * $Id: rel.h,v 1.31 2000/01/10 17:14:44 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -51,7 +51,7 @@ typedef struct Trigger bool tgdeferrable; bool tginitdeferred; int16 tgnargs; - int16 tgattr[8]; + int16 tgattr[FUNC_MAX_ARGS]; char **tgargs; } Trigger; diff --git a/src/pl/plpgsql/src/pl_comp.c b/src/pl/plpgsql/src/pl_comp.c index ef5911c603..9d509e2c38 100644 --- a/src/pl/plpgsql/src/pl_comp.c +++ b/src/pl/plpgsql/src/pl_comp.c @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.14 1999/12/20 01:41:32 tgl Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/pl_comp.c,v 1.15 2000/01/10 17:14:45 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -114,7 +114,7 @@ plpgsql_compile(Oid fn_oid, int functype) PLpgSQL_row *row; PLpgSQL_rec *rec; int i; - int arg_varnos[MAXFMGRARGS]; + int arg_varnos[FUNC_MAX_ARGS]; /* ---------- * Initialize the compiler diff --git a/src/pl/plpgsql/src/plpgsql.h b/src/pl/plpgsql/src/plpgsql.h index 9d0573bcd7..4b82abdc3e 100644 --- a/src/pl/plpgsql/src/plpgsql.h +++ b/src/pl/plpgsql/src/plpgsql.h @@ -3,7 +3,7 @@ * procedural language * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.4 1999/07/17 20:18:47 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/plpgsql.h,v 1.5 2000/01/10 17:14:45 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -377,7 +377,7 @@ typedef struct PLpgSQL_function bool fn_retset; int fn_nargs; - int fn_argvarnos[MAXFMGRARGS]; + int fn_argvarnos[FUNC_MAX_ARGS]; int found_varno; int new_varno; int old_varno; diff --git a/src/pl/tcl/pltcl.c b/src/pl/tcl/pltcl.c index 8db608b0da..cf89817d45 100644 --- a/src/pl/tcl/pltcl.c +++ b/src/pl/tcl/pltcl.c @@ -3,7 +3,7 @@ * procedural language (PL) * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.16 2000/01/05 18:23:54 momjian Exp $ + * $Header: /cvsroot/pgsql/src/pl/tcl/pltcl.c,v 1.17 2000/01/10 17:14:46 momjian Exp $ * * This software is copyrighted by Jan Wieck - Hamburg. * @@ -67,10 +67,10 @@ typedef struct pltcl_proc_desc Oid result_in_elem; int result_in_len; int nargs; - FmgrInfo arg_out_func[MAXFMGRARGS]; - Oid arg_out_elem[MAXFMGRARGS]; - int arg_out_len[MAXFMGRARGS]; - int arg_is_rel[MAXFMGRARGS]; + FmgrInfo arg_out_func[FUNC_MAX_ARGS]; + Oid arg_out_elem[FUNC_MAX_ARGS]; + int arg_out_len[FUNC_MAX_ARGS]; + int arg_is_rel[FUNC_MAX_ARGS]; } pltcl_proc_desc; -- 2.40.0