diff options
author | Thomas G. Lockhart <lockhart@fourpalms.org> | 2000-11-07 16:01:01 +0000 |
---|---|---|
committer | Thomas G. Lockhart <lockhart@fourpalms.org> | 2000-11-07 16:01:01 +0000 |
commit | e6e893e74f97ca29f4d0acfcd2cea901d4b9701f (patch) | |
tree | 731a1de82b6f5b1cd3678f24a622012add6c9675 /src/backend/parser/parse_oper.c | |
parent | 3af2827f5bf8fbaf80e2aa7c111df3c5db840be6 (diff) | |
download | postgresql-e6e893e74f97ca29f4d0acfcd2cea901d4b9701f.tar.gz postgresql-e6e893e74f97ca29f4d0acfcd2cea901d4b9701f.zip |
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.
Diffstat (limited to 'src/backend/parser/parse_oper.c')
-rw-r--r-- | src/backend/parser/parse_oper.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/backend/parser/parse_oper.c b/src/backend/parser/parse_oper.c index 73be990c010..7b30131251e 100644 --- a/src/backend/parser/parse_oper.c +++ b/src/backend/parser/parse_oper.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.41 2000/05/28 17:56:00 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_oper.c,v 1.42 2000/11/07 16:01:01 thomas Exp $ * *------------------------------------------------------------------------- */ @@ -443,8 +443,21 @@ oper_select_candidate(int nargs, } else if (current_category != slot_category) { - /* punt if more than one category for this slot */ - return NULL; + /* started out as unknown type, so give preference to string type, if available */ + if (current_category == STRING_TYPE) + { + /* forget all previous candidates */ + candidates = current_candidate; + last_candidate = current_candidate; + } + else if (slot_category == STRING_TYPE) + { + /* forget this candidate */ + if (last_candidate) + last_candidate->next = current_candidate->next; + else + candidates = current_candidate->next; + } } else if (current_type != slot_type) { |