Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit e6e893e

Browse files
author
Thomas G. Lockhart
committed
Enable fallback to string type when argument(s) are of UNKNOWN type.
Same code exactly as for function resolution. An obvious example is for select '1' = '01'; which used to throw an error and which now resolves to two text strings.
1 parent 3af2827 commit e6e893e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/backend/parser/parse_oper.c

Lines changed: 16 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_oper.c,v 1.41 2000/05/28 17:56:00 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.42 2000/11/07 16:01:01 thomas Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -443,8 +443,21 @@ oper_select_candidate(int nargs,
443443
}
444444
else if (current_category != slot_category)
445445
{
446-
/* punt if more than one category for this slot */
447-
return NULL;
446+
/* started out as unknown type, so give preference to string type, if available */
447+
if (current_category == STRING_TYPE)
448+
{
449+
/* forget all previous candidates */
450+
candidates = current_candidate;
451+
last_candidate = current_candidate;
452+
}
453+
else if (slot_category == STRING_TYPE)
454+
{
455+
/* forget this candidate */
456+
if (last_candidate)
457+
last_candidate->next = current_candidate->next;
458+
else
459+
candidates = current_candidate->next;
460+
}
448461
}
449462
else if (current_type != slot_type)
450463
{

0 commit comments

Comments
 (0)