1997-11-25 23:07:18 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* parse_func.h
|
1997-11-25 23:07:18 +01:00
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
2008-01-01 20:46:01 +01:00
|
|
|
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1997-11-25 23:07:18 +01:00
|
|
|
*
|
2008-12-28 19:54:01 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/parser/parse_func.h,v 1.63 2008/12/28 18:54:01 tgl Exp $
|
1997-11-25 23:07:18 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PARSER_FUNC_H
|
|
|
|
#define PARSER_FUNC_H
|
|
|
|
|
2003-05-26 02:11:29 +02:00
|
|
|
#include "catalog/namespace.h"
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "parser/parse_node.h"
|
1997-11-25 23:07:18 +01:00
|
|
|
|
2003-04-30 00:13:11 +02:00
|
|
|
|
1997-11-25 23:07:18 +01:00
|
|
|
/*
|
|
|
|
* This structure is used to explore the inheritance hierarchy above
|
|
|
|
* nodes in the type tree in order to disambiguate among polymorphic
|
|
|
|
* functions.
|
|
|
|
*/
|
|
|
|
typedef struct _InhPaths
|
|
|
|
{
|
|
|
|
int nsupers; /* number of superclasses */
|
|
|
|
Oid self; /* this class */
|
|
|
|
Oid *supervec; /* vector of superclasses */
|
|
|
|
} InhPaths;
|
|
|
|
|
2001-10-05 00:06:46 +02:00
|
|
|
/* Result codes for func_get_detail */
|
|
|
|
typedef enum
|
|
|
|
{
|
2003-07-04 04:51:34 +02:00
|
|
|
FUNCDETAIL_NOTFOUND, /* no matching function */
|
|
|
|
FUNCDETAIL_MULTIPLE, /* too many matching functions */
|
2002-04-11 22:00:18 +02:00
|
|
|
FUNCDETAIL_NORMAL, /* found a matching regular function */
|
|
|
|
FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */
|
2008-12-28 19:54:01 +01:00
|
|
|
FUNCDETAIL_WINDOWFUNC, /* found a matching window function */
|
2001-10-28 07:26:15 +01:00
|
|
|
FUNCDETAIL_COERCION /* it's a type coercion request */
|
2001-10-05 00:06:46 +02:00
|
|
|
} FuncDetailCode;
|
|
|
|
|
|
|
|
|
New comment. This func/column things has always confused me.
/*
* parse function
* This code is confusing because the database can accept
* relation.column, column.function, or relation.column.function.
* In these cases, funcname is the last parameter, and fargs are
* the rest.
*
* It can also be called as func(col) or func(col,col).
* In this case, Funcname is the part before parens, and fargs
* are the part in parens.
*
*/
Node *
ParseFuncOrColumn(ParseState *pstate, char *funcname, List *fargs,
bool agg_star, bool agg_distinct,
int precedence)
2001-05-19 02:33:20 +02:00
|
|
|
extern Node *ParseFuncOrColumn(ParseState *pstate,
|
2002-04-09 22:35:55 +02:00
|
|
|
List *funcname, List *fargs,
|
2008-07-16 03:30:23 +02:00
|
|
|
bool agg_star, bool agg_distinct, bool func_variadic,
|
2008-12-28 19:54:01 +01:00
|
|
|
WindowDef *over, bool is_column, int location);
|
1997-11-25 23:07:18 +01:00
|
|
|
|
2002-04-09 22:35:55 +02:00
|
|
|
extern FuncDetailCode func_get_detail(List *funcname, List *fargs,
|
2008-12-18 19:20:35 +01:00
|
|
|
int nargs, Oid *argtypes,
|
|
|
|
bool expand_variadic, bool expand_defaults,
|
2001-10-25 07:50:21 +02:00
|
|
|
Oid *funcid, Oid *rettype,
|
2008-12-04 18:51:28 +01:00
|
|
|
bool *retset, int *nvargs, Oid **true_typeids,
|
|
|
|
List **argdefaults);
|
2000-08-20 02:44:19 +02:00
|
|
|
|
2003-08-04 02:43:34 +02:00
|
|
|
extern int func_match_argtypes(int nargs,
|
|
|
|
Oid *input_typeids,
|
|
|
|
FuncCandidateList raw_candidates,
|
|
|
|
FuncCandidateList *candidates);
|
2003-05-26 02:11:29 +02:00
|
|
|
|
|
|
|
extern FuncCandidateList func_select_candidate(int nargs,
|
2003-08-04 02:43:34 +02:00
|
|
|
Oid *input_typeids,
|
|
|
|
FuncCandidateList candidates);
|
2003-05-26 02:11:29 +02:00
|
|
|
|
2000-03-16 07:35:07 +01:00
|
|
|
extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId);
|
|
|
|
|
2003-04-30 00:13:11 +02:00
|
|
|
extern void make_fn_arguments(ParseState *pstate,
|
2003-08-04 02:43:34 +02:00
|
|
|
List *fargs,
|
|
|
|
Oid *actual_arg_types,
|
|
|
|
Oid *declared_arg_types);
|
2003-04-09 01:20:04 +02:00
|
|
|
|
2003-07-20 23:56:35 +02:00
|
|
|
extern const char *funcname_signature_string(const char *funcname,
|
2003-08-04 02:43:34 +02:00
|
|
|
int nargs, const Oid *argtypes);
|
2003-07-04 04:51:34 +02:00
|
|
|
extern const char *func_signature_string(List *funcname,
|
2003-08-04 02:43:34 +02:00
|
|
|
int nargs, const Oid *argtypes);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2003-08-04 02:43:34 +02:00
|
|
|
extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes,
|
|
|
|
bool noError);
|
2002-09-04 22:31:48 +02:00
|
|
|
extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
|
2003-08-04 02:43:34 +02:00
|
|
|
bool noError);
|
2006-04-15 19:45:46 +02:00
|
|
|
extern Oid LookupAggNameTypeNames(List *aggname, List *argtypes,
|
2006-10-04 02:30:14 +02:00
|
|
|
bool noError);
|
2002-04-09 22:35:55 +02:00
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PARSE_FUNC_H */
|