Re: citext operator precedence fix - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: citext operator precedence fix
Date
Msg-id C3AA4F41-074B-4907-9A66-64A0BD7E934A@kineticode.com
Whole thread Raw
In response to Re: citext operator precedence fix  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: citext operator precedence fix
List pgsql-hackers
On Sep 21, 2011, at 6:12 PM, Tom Lane wrote:

>> Any idea of how to test for that?  What kind of situations would make
>> things difficult for the parser?
>
> Not sure, but it would be underspecified cases such as 'x' = 'x' that
> might have trouble.  I may be worrying over nothing --- I'm just trying
> to point out some trouble spots you'd better watch for while messing
> with this.

Right, we'd need to make sure that 'x' = 'x' resolves to 'x'::text = 'x'::text. Josh, I think the issue Tom is raising
issomething I've seen when there are multiple functions that could be correct for a given call. For example: 
   select citext_eq('x', 'x'::citext);

If you have these functions:

1. citext_eq(citext,citext)
2. citext_eq(text,citext)
3. citext_eq(citext,text)

Then the question is: does it find only #2 via polymorphic lookup, or does it think that either #1 or #2 could work
(becausetext supports an implicit cast to citext, IIRC). If it's more than one it's an error. Not sure if the same
issueexists for operators. 

This is easy to test for, however, so we'll soon know if there's an issue.

Best,

David

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [v9.2] make_greater_string() does not return a string in some cases
Next
From: Tom Lane
Date:
Subject: Re: [v9.2] make_greater_string() does not return a string in some cases