From 03b0a589d1d43c91224bc148d50c3242c6776058 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 4 Oct 2001 22:06:46 +0000 Subject: Consider interpreting a function call as a trivial (binary-compatible) type coercion after failing to find an exact match in pg_proc, but before considering interpretations that involve a function call with one or more argument type coercions. This avoids surprises wherein what looks like a type coercion is interpreted as coercing to some third type and then to the destination type, as in Dave Blasby's bug report of 3-Oct-01. See subsequent discussion in pghackers. --- src/include/parser/parse_func.h | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/include/parser') diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index 105781b96c3..44c774db5ed 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.31 2001/05/19 00:33:20 momjian Exp $ + * $Id: parse_func.h,v 1.32 2001/10/04 22:06:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -38,6 +38,15 @@ typedef struct _CandidateList struct _CandidateList *next; } *CandidateList; +/* Result codes for func_get_detail */ +typedef enum +{ + FUNCDETAIL_NOTFOUND, /* no suitable interpretation */ + FUNCDETAIL_NORMAL, /* found a matching function */ + FUNCDETAIL_COERCION /* it's a type coercion request */ +} FuncDetailCode; + + extern Node *ParseNestedFuncOrColumn(ParseState *pstate, Attr *attr, int precedence); extern Node *ParseFuncOrColumn(ParseState *pstate, @@ -45,9 +54,10 @@ extern Node *ParseFuncOrColumn(ParseState *pstate, bool agg_star, bool agg_distinct, int precedence); -extern bool func_get_detail(char *funcname, int nargs, Oid *argtypes, - Oid *funcid, Oid *rettype, - bool *retset, Oid **true_typeids); +extern FuncDetailCode func_get_detail(char *funcname, List *fargs, + int nargs, Oid *argtypes, + Oid *funcid, Oid *rettype, + bool *retset, Oid **true_typeids); extern bool typeInheritsFrom(Oid subclassTypeId, Oid superclassTypeId); -- cgit v1.2.3