Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit155e0b9

Browse files
author
Thomas G. Lockhart
committed
Allow type resolution for UNKNOWN arguments to functions to fall back to
any available string type. Previously, all candidate choices must have fallen within the same "type category" for PostgreSQL to be willing to choose any of them.Need to apply the same fixup to operator type resolution.
1 parent493635b commit155e0b9

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

‎src/backend/parser/parse_func.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.91 2000/09/29 18:21:36 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_func.c,v 1.92 2000/11/06 15:42:30 thomas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -921,6 +921,10 @@ func_select_candidate(int nargs,
921921
* eliminate some candidates because they are non-preferred at the
922922
* first slot, we won't notice that they didn't have the same type
923923
* category for a later slot.
924+
* XXX Hmm. How else would you do this? These candidates are here because
925+
* they all have the same number of matches on arguments with explicit
926+
* types, so from here on left-to-right resolution is as good as any.
927+
* Need a counterexample to see otherwise...
924928
*/
925929
for (i=0;i<nargs;i++)
926930
{
@@ -944,8 +948,21 @@ func_select_candidate(int nargs,
944948
}
945949
elseif (current_category!=slot_category)
946950
{
947-
/* punt if more than one category for this slot */
948-
returnNULL;
951+
/* started out as unknown type, so give preference to string type, if available */
952+
if (current_category==STRING_TYPE)
953+
{
954+
/* forget all previous candidates */
955+
candidates=current_candidate;
956+
last_candidate=current_candidate;
957+
}
958+
elseif (slot_category==STRING_TYPE)
959+
{
960+
/* forget this candidate */
961+
if (last_candidate)
962+
last_candidate->next=current_candidate->next;
963+
else
964+
candidates=current_candidate->next;
965+
}
949966
}
950967
elseif (current_type!=slot_type)
951968
{
@@ -982,6 +999,7 @@ func_select_candidate(int nargs,
982999
returnNULL;/* no remaining candidates */
9831000
if (candidates->next!=NULL)
9841001
returnNULL;/* more than one remaining candidate */
1002+
9851003
returncandidates->args;
9861004
}/* func_select_candidate() */
9871005

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp