Do a better job of selecting candidates among functions
when no exact match. Clean up elog error messages.
This commit is contained in:
parent
b4def32439
commit
681c587d22
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.38 1999/02/13 23:17:08 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.39 1999/02/23 07:51:53 thomas Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
@ -828,12 +828,13 @@ func_select_candidate(int nargs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ncandidates == 1)
|
||||||
|
return candidates->args;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Still too many candidates?
|
* Still too many candidates?
|
||||||
* Try assigning types for the unknown columns.
|
* Try assigning types for the unknown columns.
|
||||||
*/
|
*/
|
||||||
if (ncandidates > 1)
|
|
||||||
{
|
|
||||||
for (i = 0; i < nargs; i++)
|
for (i = 0; i < nargs; i++)
|
||||||
{
|
{
|
||||||
if (input_typeids[i] == UNKNOWNOID)
|
if (input_typeids[i] == UNKNOWNOID)
|
||||||
|
@ -865,8 +866,9 @@ func_select_candidate(int nargs,
|
||||||
slot_type = current_type;
|
slot_type = current_type;
|
||||||
candidates = current_candidate;
|
candidates = current_candidate;
|
||||||
}
|
}
|
||||||
else
|
else if (IsPreferredType(slot_category, slot_type))
|
||||||
{
|
{
|
||||||
|
candidates->next = current_candidate->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -886,7 +888,6 @@ func_select_candidate(int nargs,
|
||||||
current_candidate != NULL;
|
current_candidate != NULL;
|
||||||
current_candidate = current_candidate->next)
|
current_candidate = current_candidate->next)
|
||||||
ncandidates++;
|
ncandidates++;
|
||||||
}
|
|
||||||
|
|
||||||
if (ncandidates == 1)
|
if (ncandidates == 1)
|
||||||
return candidates->args;
|
return candidates->args;
|
||||||
|
@ -1012,7 +1013,7 @@ func_get_detail(char *funcname,
|
||||||
{
|
{
|
||||||
tp = typeidType(oid_array[0]);
|
tp = typeidType(oid_array[0]);
|
||||||
if (typeTypeFlag(tp) == 'c')
|
if (typeTypeFlag(tp) == 'c')
|
||||||
elog(ERROR, "func_get_detail: No such attribute or function '%s'", funcname);
|
elog(ERROR, "No such attribute or function '%s'", funcname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue