Do a better job of selecting candidates among functions

when no exact match.
Clean up elog error messages.
This commit is contained in:
Thomas G. Lockhart 1999-02-23 07:51:53 +00:00
parent b4def32439
commit 681c587d22
1 changed files with 51 additions and 50 deletions

View File

@ -7,7 +7,7 @@
*
*
* 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?
* Try assigning types for the unknown columns.
*/
if (ncandidates > 1)
{
for (i = 0; i < nargs; i++)
{
if (input_typeids[i] == UNKNOWNOID)
@ -865,8 +866,9 @@ func_select_candidate(int nargs,
slot_type = current_type;
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 = current_candidate->next)
ncandidates++;
}
if (ncandidates == 1)
return candidates->args;
@ -1012,7 +1013,7 @@ func_get_detail(char *funcname,
{
tp = typeidType(oid_array[0]);
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