You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
postgres/src/include/parser/parse_func.h

76 lines
2.4 KiB

/*-------------------------------------------------------------------------
*
* parse_func.h
*
*
*
* Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/parser/parse_func.h
*
*-------------------------------------------------------------------------
*/
#ifndef PARSER_FUNC_H
#define PARSER_FUNC_H
#include "catalog/namespace.h"
#include "parser/parse_node.h"
/* Result codes for func_get_detail */
typedef enum
{
FUNCDETAIL_NOTFOUND, /* no matching function */
FUNCDETAIL_MULTIPLE, /* too many matching functions */
FUNCDETAIL_NORMAL, /* found a matching regular function */
FUNCDETAIL_AGGREGATE, /* found a matching aggregate function */
FUNCDETAIL_WINDOWFUNC, /* found a matching window function */
FUNCDETAIL_COERCION /* it's a type coercion request */
} FuncDetailCode;
extern Node *ParseFuncOrColumn(ParseState *pstate, List *funcname, List *fargs,
Support ordered-set (WITHIN GROUP) aggregates. This patch introduces generic support for ordered-set and hypothetical-set aggregate functions, as well as implementations of the instances defined in SQL:2008 (percentile_cont(), percentile_disc(), rank(), dense_rank(), percent_rank(), cume_dist()). We also added mode() though it is not in the spec, as well as versions of percentile_cont() and percentile_disc() that can compute multiple percentile values in one pass over the data. Unlike the original submission, this patch puts full control of the sorting process in the hands of the aggregate's support functions. To allow the support functions to find out how they're supposed to sort, a new API function AggGetAggref() is added to nodeAgg.c. This allows retrieval of the aggregate call's Aggref node, which may have other uses beyond the immediate need. There is also support for ordered-set aggregates to install cleanup callback functions, so that they can be sure that infrastructure such as tuplesort objects gets cleaned up. In passing, make some fixes in the recently-added support for variadic aggregates, and make some editorial adjustments in the recent FILTER additions for aggregates. Also, simplify use of IsBinaryCoercible() by allowing it to succeed whenever the target type is ANY or ANYELEMENT. It was inconsistent that it dealt with other polymorphic target types but not these. Atri Sharma and Andrew Gierth; reviewed by Pavel Stehule and Vik Fearing, and rather heavily editorialized upon by Tom Lane
12 years ago
FuncCall *fn, int location);
extern TableSampleClause *ParseTableSample(ParseState *pstate,
char *samplemethod,
Node *repeatable, List *args,
int location);
extern FuncDetailCode func_get_detail(List *funcname,
List *fargs, List *fargnames,
int nargs, Oid *argtypes,
bool expand_variadic, bool expand_defaults,
Oid *funcid, Oid *rettype,
bool *retset, int *nvargs, Oid *vatype,
Oid **true_typeids, List **argdefaults);
22 years ago
extern int func_match_argtypes(int nargs,
Oid *input_typeids,
FuncCandidateList raw_candidates,
FuncCandidateList *candidates);
extern FuncCandidateList func_select_candidate(int nargs,
22 years ago
Oid *input_typeids,
FuncCandidateList candidates);
extern void make_fn_arguments(ParseState *pstate,
22 years ago
List *fargs,
Oid *actual_arg_types,
Oid *declared_arg_types);
extern const char *funcname_signature_string(const char *funcname, int nargs,
List *argnames, const Oid *argtypes);
extern const char *func_signature_string(List *funcname, int nargs,
List *argnames, const Oid *argtypes);
22 years ago
extern Oid LookupFuncName(List *funcname, int nargs, const Oid *argtypes,
bool noError);
23 years ago
extern Oid LookupFuncNameTypeNames(List *funcname, List *argtypes,
22 years ago
bool noError);
extern Oid LookupAggNameTypeNames(List *aggname, List *argtypes,
bool noError);
#endif /* PARSE_FUNC_H */