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
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
2001-01-24 20:43:33 +01:00
|
|
|
* Portions Copyright (c) 1996-2001, 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
|
|
|
*
|
2002-04-11 22:00:18 +02:00
|
|
|
* $Id: parse_func.h,v 1.39 2002/04/11 20:00:15 tgl Exp $
|
1997-11-25 23:07:18 +01:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef PARSER_FUNC_H
|
|
|
|
#define PARSER_FUNC_H
|
|
|
|
|
1999-07-16 01:04:24 +02:00
|
|
|
#include "parser/parse_node.h"
|
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;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This structure holds a list of possible functions or operators that
|
|
|
|
* agree with the known name and argument types of the function/operator.
|
|
|
|
*/
|
|
|
|
typedef struct _CandidateList
|
|
|
|
{
|
|
|
|
Oid *args;
|
|
|
|
struct _CandidateList *next;
|
2001-11-05 18:46:40 +01:00
|
|
|
} *CandidateList;
|
1997-11-25 23:07:18 +01:00
|
|
|
|
2001-10-05 00:06:46 +02:00
|
|
|
/* Result codes for func_get_detail */
|
|
|
|
typedef enum
|
|
|
|
{
|
2001-10-28 07:26:15 +01:00
|
|
|
FUNCDETAIL_NOTFOUND, /* no suitable interpretation */
|
2002-04-11 22:00:18 +02:00
|
|
|
FUNCDETAIL_NORMAL, /* found a matching regular function */
|
|
|
|
FUNCDETAIL_AGGREGATE, /* found a matching aggregate 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,
|
2002-03-21 17:02:16 +01:00
|
|
|
bool agg_star, bool agg_distinct, bool is_column);
|
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,
|
2001-10-25 07:50:21 +02:00
|
|
|
int nargs, Oid *argtypes,
|
|
|
|
Oid *funcid, Oid *rettype,
|
|
|
|
bool *retset, Oid **true_typeids);
|
2000-08-20 02:44:19 +02:00
|
|
|
|
2000-03-16 07:35:07 +01:00
|
|
|
extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId);
|
|
|
|
|
2002-04-09 22:35:55 +02:00
|
|
|
extern void func_error(const char *caller, List *funcname,
|
2002-03-29 20:06:29 +01:00
|
|
|
int nargs, const Oid *argtypes,
|
|
|
|
const char *msg);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2002-04-11 22:00:18 +02:00
|
|
|
extern Oid find_aggregate_func(const char *caller, List *aggname,
|
|
|
|
Oid basetype);
|
|
|
|
|
2002-04-09 22:35:55 +02:00
|
|
|
extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes);
|
|
|
|
extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
|
|
|
|
bool opaqueOK, const char *caller);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* PARSE_FUNC_H */
|