Commit 681c587d authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Do a better job of selecting candidates among functions

 when no exact match.
Clean up elog error messages.
parent b4def324
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment