Re: citext operator precedence fix

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: citext operator precedence fix
Date: 2011-09-22 03:18:26
Message-ID: C3AA4F41-074B-4907-9A66-64A0BD7E934A@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 is something 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 (because text supports an implicit cast to citext, IIRC). If it's more than one it's an error. Not sure if the same issue exists for operators.

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

Best,

David

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-09-22 04:24:04 Re: [v9.2] make_greater_string() does not return a string in some cases
Previous Message Robert Haas 2011-09-22 03:04:02 Re: [v9.2] make_greater_string() does not return a string in some cases