aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-04-09 20:35:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-04-09 20:35:55 +0000
commitf2d70d32ebd6c38d4fe93c1a684f5f29e5e76938 (patch)
tree5d041018177cdf6e9ca3ef0cc2eafac580a5bb0b /src/include
parentc419c224142eb4bbf6e9a47d2d3626f212fda0fc (diff)
downloadpostgresql-f2d70d32ebd6c38d4fe93c1a684f5f29e5e76938.tar.gz
postgresql-f2d70d32ebd6c38d4fe93c1a684f5f29e5e76938.zip
Functions live in namespaces. Qualified function names work, eg
SELECT schema1.func2(...). Aggregate names can be qualified at the syntactic level, but the qualification is ignored for the moment.
Diffstat (limited to 'src/include')
-rw-r--r--src/include/catalog/namespace.h4
-rw-r--r--src/include/catalog/pg_aggregate.h6
-rw-r--r--src/include/commands/comment.h5
-rw-r--r--src/include/commands/defrem.h6
-rw-r--r--src/include/nodes/parsenodes.h42
-rw-r--r--src/include/nodes/pg_list.h4
-rw-r--r--src/include/parser/gramparse.h3
-rw-r--r--src/include/parser/parse_agg.h6
-rw-r--r--src/include/parser/parse_func.h12
-rw-r--r--src/include/utils/syscache.h4
10 files changed, 49 insertions, 43 deletions
diff --git a/src/include/catalog/namespace.h b/src/include/catalog/namespace.h
index 4c81e78f3ff..15a21e77d5d 100644
--- a/src/include/catalog/namespace.h
+++ b/src/include/catalog/namespace.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: namespace.h,v 1.6 2002/04/06 06:59:24 tgl Exp $
+ * $Id: namespace.h,v 1.7 2002/04/09 20:35:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,6 +47,8 @@ extern Oid QualifiedNameGetCreationNamespace(List *names, char **objname_p);
extern RangeVar *makeRangeVarFromNameList(List *names);
+extern char *NameListToString(List *names);
+
extern bool isTempNamespace(Oid namespaceId);
/* stuff for search_path GUC variable */
diff --git a/src/include/catalog/pg_aggregate.h b/src/include/catalog/pg_aggregate.h
index 65494e8afe2..3d44f4c4c0f 100644
--- a/src/include/catalog/pg_aggregate.h
+++ b/src/include/catalog/pg_aggregate.h
@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_aggregate.h,v 1.36 2002/03/29 19:06:18 tgl Exp $
+ * $Id: pg_aggregate.h,v 1.37 2002/04/09 20:35:54 tgl Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
@@ -157,8 +157,8 @@ DATA(insert OID = 0 ( stddev PGUID numeric_accum numeric_stddev 1700 1231 1700
*/
extern void AggregateCreate(const char *aggName,
Oid aggNamespace,
- char *aggtransfnName,
- char *aggfinalfnName,
+ List *aggtransfnName,
+ List *aggfinalfnName,
Oid aggBaseType,
Oid aggTransType,
const char *agginitval);
diff --git a/src/include/commands/comment.h b/src/include/commands/comment.h
index f1e9a760b0b..bf2acfcfa0e 100644
--- a/src/include/commands/comment.h
+++ b/src/include/commands/comment.h
@@ -12,7 +12,7 @@
#ifndef COMMENT_H
#define COMMENT_H
-#include "nodes/pg_list.h"
+#include "nodes/parsenodes.h"
/*------------------------------------------------------------------
* Function Prototypes --
@@ -25,8 +25,7 @@
*------------------------------------------------------------------
*/
-extern void CommentObject(int objtype, char * schemaname, char *objname,
- char *objproperty, List *objlist, char *comment);
+extern void CommentObject(CommentStmt *stmt);
extern void DeleteComments(Oid oid, Oid classoid);
diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h
index 69f180ec162..83b8fec6d77 100644
--- a/src/include/commands/defrem.h
+++ b/src/include/commands/defrem.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: defrem.h,v 1.33 2002/03/29 19:06:22 tgl Exp $
+ * $Id: defrem.h,v 1.34 2002/04/09 20:35:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,10 +45,10 @@ extern void DefineDomain(CreateDomainStmt *stmt);
* prototypes in remove.c
*/
extern void RemoveDomain(List *names, int behavior);
-extern void RemoveFunction(char *functionName, List *argTypes);
+extern void RemoveFunction(List *functionName, List *argTypes);
extern void RemoveOperator(char *operatorName,
TypeName *typeName1, TypeName *typeName2);
extern void RemoveType(List *names);
-extern void RemoveAggregate(char *aggName, TypeName *aggType);
+extern void RemoveAggregate(List *aggName, TypeName *aggType);
#endif /* DEFREM_H */
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index e2b0d9f38f3..6fc2fec9ad9 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parsenodes.h,v 1.168 2002/04/05 11:56:54 momjian Exp $
+ * $Id: parsenodes.h,v 1.169 2002/04/09 20:35:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -304,7 +304,7 @@ typedef struct Ident
typedef struct FuncCall
{
NodeTag type;
- char *funcname; /* name of function */
+ List *funcname; /* qualified name of function */
List *args; /* the arguments (list of exprs) */
bool agg_star; /* argument was really '*' */
bool agg_distinct; /* arguments were labeled DISTINCT */
@@ -390,15 +390,16 @@ typedef struct RangeSubselect
/*
* IndexElem - index parameters (used in CREATE INDEX)
*
- * For a plain index, each 'name' is an attribute name in the heap relation,
- * and 'args' is NIL. For a functional index, only one IndexElem is allowed.
- * It has name = name of function and args = list of attribute names that
- * are the function's arguments.
+ * For a plain index, each 'name' is an attribute name in the heap relation;
+ * 'funcname' and 'args' are NIL. For a functional index, only one IndexElem
+ * is allowed. It has name = NULL, funcname = name of function and args =
+ * list of attribute names that are the function's arguments.
*/
typedef struct IndexElem
{
NodeTag type;
- char *name; /* name of attribute to index, or function */
+ char *name; /* name of attribute to index, or NULL */
+ List *funcname; /* qualified name of function */
List *args; /* list of names of function arguments */
char *class; /* name of desired opclass; NULL = default */
} IndexElem;
@@ -780,7 +781,7 @@ typedef struct PrivGrantee
typedef struct FuncWithArgs
{
NodeTag type;
- char *funcname;
+ List *funcname; /* qualified name of function */
List *funcargs; /* list of Typename nodes */
} FuncWithArgs;
@@ -919,10 +920,10 @@ typedef struct FkConstraint
typedef struct CreateTrigStmt
{
NodeTag type;
- char *trigname; /* TRIGGER' name */
- RangeVar *relation; /* triggered relation */
- char *funcname; /* function to call (or NULL) */
- List *args; /* list of (T_String) Values or NULL */
+ char *trigname; /* TRIGGER's name */
+ RangeVar *relation; /* relation trigger is on */
+ List *funcname; /* qual. name of function to call */
+ List *args; /* list of (T_String) Values or NIL */
bool before; /* BEFORE/AFTER */
bool row; /* ROW/STATEMENT */
char actions[4]; /* Insert, Update, Delete */
@@ -954,7 +955,7 @@ typedef struct CreatePLangStmt
{
NodeTag type;
char *plname; /* PL name */
- char *plhandler; /* PL call handler function */
+ List *plhandler; /* PL call handler function (qual. name) */
char *plcompiler; /* lancompiler text */
bool pltrusted; /* PL is trusted */
} CreatePLangStmt;
@@ -1097,12 +1098,9 @@ typedef struct CommentStmt
{
NodeTag type;
int objtype; /* Object's type */
- char *objschema; /* Schema where object is defined,
- * if object is schema specific */
- char *objname; /* Name of the object */
- char *objproperty; /* Property Id (such as column) */
- List *objlist; /* Arguments for VAL objects */
- char *comment; /* The comment to insert */
+ List *objname; /* Qualified name of the object */
+ List *objargs; /* Arguments if needed (eg, for functions) */
+ char *comment; /* Comment to insert, or NULL to remove */
} CommentStmt;
/* ----------------------
@@ -1154,7 +1152,7 @@ typedef struct ProcedureStmt
{
NodeTag type;
bool replace; /* T => replace if already exists */
- List *funcname; /* name of function to create */
+ List *funcname; /* qualified name of function to create */
List *argTypes; /* list of argument types (TypeName nodes) */
TypeName *returnType; /* the return type */
List *withClause; /* a list of DefElem */
@@ -1169,7 +1167,7 @@ typedef struct ProcedureStmt
typedef struct RemoveAggrStmt
{
NodeTag type;
- char *aggname; /* aggregate to drop */
+ List *aggname; /* aggregate to drop */
TypeName *aggtype; /* TypeName for input datatype, or NULL */
} RemoveAggrStmt;
@@ -1180,7 +1178,7 @@ typedef struct RemoveAggrStmt
typedef struct RemoveFuncStmt
{
NodeTag type;
- char *funcname; /* function to drop */
+ List *funcname; /* function to drop */
List *args; /* types of the arguments */
} RemoveFuncStmt;
diff --git a/src/include/nodes/pg_list.h b/src/include/nodes/pg_list.h
index 6b224d6c385..722fb772916 100644
--- a/src/include/nodes/pg_list.h
+++ b/src/include/nodes/pg_list.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: pg_list.h,v 1.26 2001/11/05 17:46:34 momjian Exp $
+ * $Id: pg_list.h,v 1.27 2002/04/09 20:35:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -109,6 +109,8 @@ typedef struct List
* function prototypes in nodes/list.c
*/
extern int length(List *list);
+extern void *llast(List *list);
+extern int llasti(List *list);
extern List *nconc(List *list1, List *list2);
extern List *lcons(void *datum, List *list);
extern List *lconsi(int datum, List *list);
diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h
index a9932ab59a0..42ae42d9e63 100644
--- a/src/include/parser/gramparse.h
+++ b/src/include/parser/gramparse.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: gramparse.h,v 1.19 2001/11/05 17:46:34 momjian Exp $
+ * $Id: gramparse.h,v 1.20 2002/04/09 20:35:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -29,6 +29,7 @@ extern Oid param_type(int t);
extern int yyparse(void);
extern char *xlateSqlFunc(char *name);
extern char *xlateSqlType(char *name);
+extern List *SystemFuncName(char *name);
bool exprIsNullConstant(Node *arg);
#endif /* GRAMPARSE_H */
diff --git a/src/include/parser/parse_agg.h b/src/include/parser/parse_agg.h
index 666e4ede764..03ac8dc6462 100644
--- a/src/include/parser/parse_agg.h
+++ b/src/include/parser/parse_agg.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_agg.h,v 1.21 2002/03/21 16:01:55 tgl Exp $
+ * $Id: parse_agg.h,v 1.22 2002/04/09 20:35:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,8 +18,8 @@
extern void AddAggToParseState(ParseState *pstate, Aggref *aggref);
extern void parseCheckAggregates(ParseState *pstate, Query *qry, Node *qual);
-extern Aggref *ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
+extern Aggref *ParseAgg(ParseState *pstate, List *aggname, Oid basetype,
List *args, bool agg_star, bool agg_distinct);
-extern void agg_error(char *caller, char *aggname, Oid basetypeID);
+extern void agg_error(const char *caller, List *aggname, Oid basetypeID);
#endif /* PARSE_AGG_H */
diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h
index 01e5b16e2b5..3a7641e1de7 100644
--- a/src/include/parser/parse_func.h
+++ b/src/include/parser/parse_func.h
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: parse_func.h,v 1.37 2002/03/29 19:06:24 tgl Exp $
+ * $Id: parse_func.h,v 1.38 2002/04/09 20:35:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,18 +48,22 @@ typedef enum
extern Node *ParseFuncOrColumn(ParseState *pstate,
- char *funcname, List *fargs,
+ List *funcname, List *fargs,
bool agg_star, bool agg_distinct, bool is_column);
-extern FuncDetailCode func_get_detail(char *funcname, List *fargs,
+extern FuncDetailCode func_get_detail(List *funcname, List *fargs,
int nargs, Oid *argtypes,
Oid *funcid, Oid *rettype,
bool *retset, Oid **true_typeids);
extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId);
-extern void func_error(const char *caller, const char *funcname,
+extern void func_error(const char *caller, List *funcname,
int nargs, const Oid *argtypes,
const char *msg);
+extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes);
+extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
+ bool opaqueOK, const char *caller);
+
#endif /* PARSE_FUNC_H */
diff --git a/src/include/utils/syscache.h b/src/include/utils/syscache.h
index 1d9ddd9acfd..365d9efdb5d 100644
--- a/src/include/utils/syscache.h
+++ b/src/include/utils/syscache.h
@@ -9,7 +9,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: syscache.h,v 1.42 2002/04/06 06:59:25 tgl Exp $
+ * $Id: syscache.h,v 1.43 2002/04/09 20:35:55 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,7 @@
#define NAMESPACEOID 18
#define OPERNAME 19
#define OPEROID 20
-#define PROCNAME 21
+#define PROCNAMENSP 21
#define PROCOID 22
#define RELNAMENSP 23
#define RELOID 24