Re: citext function overloads for text parameters

2018-05-07 Thread Sergey Mirvoda
Hello hanckers, We use this simple function to workaround citext=text behavior. create extension citext; CREATE FUNCTION citext_eq( citext, text ) RETURNS bool AS 'citext' LANGUAGE C IMMUTABLE STRICT; CREATE OPERATOR = ( LEFTARG= CITEXT, RIGHTARG = TEXT, COMMUTATOR = =, NE

Re: citext function overloads for text parameters

2018-05-07 Thread Shay Rojansky
> > >> Thanks for the input. It's worth noting that the equality operator >> currently works in the same way: citext = text comparison is (surprisingly >> for me) case-sensitive. >> >> My expectation was that since citext is supposed to be a case-insensitive >> *type*, all comparison operations inv

citext function overloads for text parameters

2018-05-07 Thread David G. Johnston
On Sunday, May 6, 2018, Shay Rojansky wrote: > > > Thanks for the input. It's worth noting that the equality operator > currently works in the same way: citext = text comparison is (surprisingly > for me) case-sensitive. > > My expectation was that since citext is supposed to be a case-insensitive

Re: citext function overloads for text parameters

2018-05-06 Thread Shay Rojansky
> > > Do you think it would be appropriate to simply add an strpos(citext, > text) > > overload to the extension to make sure this behaves more as expected? If > so > > I can try to submit a patch at some point. > > To me, if there's both a citext and a text parameter, then it's simply > unclear wh

Re: citext function overloads for text parameters

2018-05-06 Thread Tom Lane
Shay Rojansky writes: > Do you think it would be appropriate to simply add an strpos(citext, text) > overload to the extension to make sure this behaves more as expected? If so > I can try to submit a patch at some point. To me, if there's both a citext and a text parameter, then it's simply uncl

Re: citext function overloads for text parameters

2018-05-06 Thread Pavel Stehule
2018-05-06 14:55 GMT+02:00 Shay Rojansky : > Thanks for your answer Pavel. > > This is expected - it is side effect of PostgreSQL implementation of >> function overloading and type conversions >> >> after installation citext, you will have more instances of function strpos >> >> strpos(citext, cit

Re: citext function overloads for text parameters

2018-05-06 Thread Shay Rojansky
Thanks for your answer Pavel. This is expected - it is side effect of PostgreSQL implementation of > function overloading and type conversions > > after installation citext, you will have more instances of function strpos > > strpos(citext, citext) > strpos(text, text) > Do you think it would be

Re: citext function overloads for text parameters

2018-05-05 Thread Pavel Stehule
2018-05-06 8:26 GMT+02:00 Shay Rojansky : > Hi hackers. > > The following works well of course: > > test=# select strpos('Aa'::citext, 'a'); > strpos > > 1 > > However, if I pass a typed text parameter for the substring, I get > case-sensitive behavior instead: > > test=# select st

citext function overloads for text parameters

2018-05-05 Thread Shay Rojansky
Hi hackers. The following works well of course: test=# select strpos('Aa'::citext, 'a'); strpos 1 However, if I pass a typed text parameter for the substring, I get case-sensitive behavior instead: test=# select strpos('Aa'::citext, 'a'::text); strpos 2 This see