Re: [HACKERS] citext operator precedence fix

2011-09-23 Thread Robert Haas
On Fri, Sep 23, 2011 at 12:37 PM, Josh Berkus wrote: >> I'm OK with the proposed behavior change and I agree that it's >> probably what people want, but I am awfully suspicious that those >> extra casts are going to break something you haven't thought about. >> It might be worth posting a rough ve

Re: [HACKERS] citext operator precedence fix

2011-09-23 Thread Josh Berkus
> I'm OK with the proposed behavior change and I agree that it's > probably what people want, but I am awfully suspicious that those > extra casts are going to break something you haven't thought about. > It might be worth posting a rough version first just to see if I (or > someone else) can brea

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Robert Haas
On Thu, Sep 22, 2011 at 2:36 PM, Josh Berkus wrote: >> But I don't think we're required to support that case.  If the user >> does a non-standard install, it's their job to deal with the fallout. > > Well, I'll write the script anyway, since *I* need it.  I'm installing > this on a 9.0 database wh

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Josh Berkus
> But I don't think we're required to support that case. If the user > does a non-standard install, it's their job to deal with the fallout. Well, I'll write the script anyway, since *I* need it. I'm installing this on a 9.0 database which will be later upgraded to 9.1. However, before I write

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread David E. Wheeler
On Sep 22, 2011, at 11:23 AM, Robert Haas wrote: > I believe the point David is trying to make is that someone might take > an 9.2 version of a contrib module and manually install it on an 8.4 > server by executing the install script, perhaps with some amount of > hackery. Right. > But I don't t

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Robert Haas
On Thu, Sep 22, 2011 at 2:16 PM, David E. Wheeler wrote: > On Sep 22, 2011, at 11:14 AM, Kevin Grittner wrote: > >>> No, because if 1.1 was installed on 8.4, you'd need the commands >>> to move all its functions into the extension, not re-create them. >> >> Shouldn't a version installed on 8.4 be

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread David E. Wheeler
On Sep 22, 2011, at 11:14 AM, Kevin Grittner wrote: >> No, because if 1.1 was installed on 8.4, you'd need the commands >> to move all its functions into the extension, not re-create them. > > Shouldn't a version installed on 8.4 be installed as "unpackaged"? > Doesn't citext--unpackaged--1.0.sql

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Kevin Grittner
"David E. Wheeler" wrote: > On Sep 22, 2011, at 11:07 AM, Alvaro Herrera wrote: >> Hmm, if there's a citext--unpackaged--1.0.sql and also >> citext--1.0--1.1.sql, is it really necessary to have >> citext--unpackaged--1.1.sql? Shouldn't the upgrade facility be >> able to just run both scripts? >

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread David E. Wheeler
On Sep 22, 2011, at 11:07 AM, Alvaro Herrera wrote: >> That is the test file. The main SQL file is citext--1.0.sql. You'll actually >> need to bump the version number to 1.1, rename that file to citext--1.1.sql, >> and also add them to a citext--1.0--1.1.sql. There probably also needs to be >>

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Alvaro Herrera
Excerpts from David E. Wheeler's message of jue sep 22 14:51:59 -0300 2011: > On Sep 22, 2011, at 10:50 AM, Josh Berkus wrote: > > >> Just write some comparisons like upthread, and see if the output is f or > >> t. Put them into sql/citext.sql. > > > > Oh, ok. I thought you meant checking the

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread David E. Wheeler
On Sep 22, 2011, at 10:50 AM, Josh Berkus wrote: >> Just write some comparisons like upthread, and see if the output is f or t. >> Put them into sql/citext.sql. > > Oh, ok. I thought you meant checking the actual function call. > > Tests go in the main SQL file? Shouldn't they have their own

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Josh Berkus
On 9/22/11 10:26 AM, David E. Wheeler wrote: > On Sep 22, 2011, at 10:11 AM, Josh Berkus wrote: > >>> That's what tests are for. >> >> So, tell me how to write a test to check which function is being used. > > Just write some comparisons like upthread, and see if the output is f or t. > Put them

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread David E. Wheeler
On Sep 22, 2011, at 10:11 AM, Josh Berkus wrote: >> That's what tests are for. > > So, tell me how to write a test to check which function is being used. Just write some comparisons like upthread, and see if the output is f or t. Put them into sql/citext.sql. Best, David -- Sent via pgsql-

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Josh Berkus
>> Well, I just ran through the 7 potential combinations, and didn't get >> any errors. Hard to tell which function is being used, of course. > > That's what tests are for. So, tell me how to write a test to check which function is being used. -- Josh Berkus PostgreSQL Experts Inc. http://pge

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread David E. Wheeler
On Sep 22, 2011, at 9:53 AM, Josh Berkus wrote: >> >> 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

Re: [HACKERS] citext operator precedence fix

2011-09-22 Thread Josh Berkus
> 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

Re: [HACKERS] citext operator precedence fix

2011-09-21 Thread David E. Wheeler
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 tr

Re: [HACKERS] citext operator precedence fix

2011-09-21 Thread Tom Lane
Josh Berkus writes: >> Yeah, I'm worried about the possibility of parser failing to resolve >> which operator is meant. > 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

Re: [HACKERS] citext operator precedence fix

2011-09-21 Thread Josh Berkus
>> Ambiguity? > > Yeah, I'm worried about the possibility of parser failing to resolve > which operator is meant. Any idea of how to test for that? What kind of situations would make things difficult for the parser? Also, how is this any different for any optional data type which overrides = ?

Re: [HACKERS] citext operator precedence fix

2011-09-21 Thread Tom Lane
Josh Berkus writes: >> I think you'll find that's easier said than done (problem 1 is going to >> be ambiguity, > Ambiguity? Yeah, I'm worried about the possibility of parser failing to resolve which operator is meant. >> and problem 2 is going to be that comparisons involving >> these operato

Re: [HACKERS] citext operator precedence fix

2011-09-21 Thread Josh Berkus
> I think you'll find that's easier said than done (problem 1 is going to > be ambiguity, Ambiguity? > and problem 2 is going to be that comparisons involving > these operators won't get indexed). Yeah, that's acceptable, since it's not any worse than the behavior of the comparisons now. --

Re: [HACKERS] citext operator precedence fix

2011-09-21 Thread Tom Lane
Josh Berkus writes: > I'd like to patch the citext contrib module for 9.2 to fix this by > creating four new = operators to establish the comparison function for > text and varchar. I think you'll find that's easier said than done (problem 1 is going to be ambiguity, and problem 2 is going to be

[HACKERS] citext operator precedence fix

2011-09-21 Thread Josh Berkus
All, I just tripped over this: select 'josh'::varchar(32) = 'Josh'::citext; ?column? -- f While it's clear why it's that way, it's not how people would expect citext to behave. Users expect case-insensitive text to be case-insensitive for *all* comparisons, not just for comparisons wi