Re: case insensitive collation of Greek's sigma

2021-12-02 Thread Gianni Ceccarelli
I realise this may not be applicable to the original problem, but non-deterministic collations seems to offer a solution:: dakkar@[local] dakkar=> create collation "en-US-ins-icu" ( provider=icu, locale='en-US-u-ks-level2', deterministic=false ); dakkar@[l

Re: case insensitive collation of Greek's sigma

2021-12-02 Thread Jakub Jedelsky
On Wed, Dec 1, 2021 at 8:49 PM Tom Lane wrote: > Peter Eisentraut writes: > > Running lower() like this is really the wrong thing to do. We should be > > doing "case folding" instead, which normalizes these differences for the > > purpose of case-insensitive comparisons. > > That just begs the

Re: case insensitive collation of Greek's sigma

2021-12-01 Thread Tom Lane
Peter Eisentraut writes: > Running lower() like this is really the wrong thing to do. We should be > doing "case folding" instead, which normalizes these differences for the > purpose of case-insensitive comparisons. That just begs the question: if tolower (or towlower) isn't the appropriate A

Re: case insensitive collation of Greek's sigma

2021-12-01 Thread Peter Eisentraut
On 26.11.21 08:37, Jakub Jedelsky wrote: postgres=# SELECT postgres-# 'ΣΣ' ILIKE 'σσ' COLLATE "en_US", postgres-# 'ΣΣ' ILIKE 'σς' COLLATE "en_US" postgres-# ;  ?column? | ?column? --+--  t        | f (1 row) postgres=# SELECT postgres-# 'ΣΣ' ILIKE 'σσ' COLLATE "en-US-x-icu", po

Re: case insensitive collation of Greek's sigma

2021-11-30 Thread Frank Limpert
Am 26.11.21 um 08:37 schrieb Jakub Jedelsky: Hello, during our tests of Postgres with ICU we found an issue with ILIKE of upper and lowercase sigma (Σ). The letter has two lowercase variants σ and ς (at the end of a word). I'm working with en_US and en-US-x-icu collations and results are a bi

Re: case insensitive collation of Greek's sigma

2021-11-26 Thread Tom Lane
Jakub Jedelsky writes: > during our tests of Postgres with ICU we found an issue with ILIKE of upper > and lowercase sigma (Σ). The letter has two lowercase variants σ and ς (at > the end of a word). I'm working with en_US and en-US-x-icu collations and > results are a bit unexpected - they are in

Re: case insensitive collation of Greek's sigma

2021-11-26 Thread Achilleas Mantzios
On 26/11/21 9:37 π.μ., Jakub Jedelsky wrote: Hello, Thank you for dealing with Greek! during our tests of Postgres with ICU we found an issue with ILIKE of upper and lowercase sigma (Σ). The letter has two lowercase variants σ and ς (at the end of a word). I'm working with en_US and en-US-x-i

Re: Case insensitive query on existing data

2020-08-13 Thread Saurav Sarkar
Thanks a lot Michael . Concurrent index building solves my problem of building index without locking. Best Regards, Saurav On Thu, Aug 13, 2020 at 10:45 PM Michael Lewis wrote: > create index concurrently lower( jsonb->>'name' ), drop old_index > concurrently, ensure that where/on/group by cond

Re: Case insensitive query on existing data

2020-08-13 Thread Michael Lewis
create index concurrently lower( jsonb->>'name' ), drop old_index concurrently, ensure that where/on/group by conditions use lower( jsonb->>'name' ), then take lunch. What's your concern with this process? >

Re: Case Insensitive Comparison with Postgres 12

2019-10-12 Thread Daniel Verite
Igal Sapir wrote: > > Out of curiosity is there a eason not to use the citext type for th? > > > > > Using the collation seems like a much cleaner approach, and I trust ICU to > do a better job at comparing strings according to language rules etc. One notable difference between citext and

Re: Case Insensitive Comparison with Postgres 12

2019-10-11 Thread Igal Sapir
On Fri, Oct 11, 2019 at 1:09 AM stan wrote: > On Thu, Oct 10, 2019 at 05:41:47AM -0700, Igal @ Lucee.org wrote: > > On 10/9/2019 12:34 AM, Laurenz Albe wrote: > > > Igal Sapir wrote: > > > > I am trying to test a simple case insensitive comparison. Most > likely the > > > > collation that I chos

Re: Case Insensitive Comparison with Postgres 12

2019-10-10 Thread Igal @ Lucee.org
Thomas, On 10/10/2019 6:22 AM, Thomas Kellerer wrote: Igal @ Lucee.org schrieb am 10.10.2019 um 14:41: Thank you all for replying. I tried to use the locale suggested by both Laurenz and Pavel, en-US-u-ks-level2, but I'm still getting false for a simple comparison of 'Abc' = 'abc'. I tried t

Re: Case Insensitive Comparison with Postgres 12

2019-10-10 Thread Thomas Kellerer
Igal @ Lucee.org schrieb am 10.10.2019 um 14:41: > Thank you all for replying. I tried to use the locale suggested by > both Laurenz and Pavel, en-US-u-ks-level2, but I'm still getting > false for a simple comparison of 'Abc' = 'abc'. I tried the locale > both as a 'string' and as an "identifier"

Re: Case Insensitive Comparison with Postgres 12

2019-10-10 Thread Igal @ Lucee.org
On 10/9/2019 12:34 AM, Laurenz Albe wrote: Igal Sapir wrote: I am trying to test a simple case insensitive comparison. Most likely the collation that I chose is wrong, but I'm not sure how to choose the correct one (for English/US?). Here is my snippet: create collation case_insensitive(

Re: Case Insensitive Comparison with Postgres 12

2019-10-09 Thread Pavel Křehula
Hello, use correct locale identifier, in your case it should be: create collation "case_insensitive" (provider=icu, locale="en-US-u-ks-level2", deterministic = false); See http://www.unicode.org/reports/tr35/tr35-collation.html#Setting_Options for available options. -- Pavel Dne 09.10.2019

Re: Case Insensitive Comparison with Postgres 12

2019-10-09 Thread Laurenz Albe
Igal Sapir wrote: > I am trying to test a simple case insensitive comparison. Most likely the > collation that I chose is wrong, but I'm not sure how to choose the correct > one (for English/US?). Here is my snippet: > > create collation case_insensitive( > provider=icu, locale='en-US-x-icu'

Re: Case Insensitive Comparison with Postgres 12

2019-10-09 Thread Wim Bertels
Using the datatype citext might be an alternative solution Igal Sapir schreef op October 8, 2019 10:51:52 PM UTC: >I am trying to test a simple case insensitive comparison. Most likely >the >collation that I chose is wrong, but I'm not sure how to choose the >correct >one (for English/US?). Her

Re: Case Insensitive Comparison with Postgres 12

2019-10-08 Thread Morris de Oryx
As I understand it, custom collation are not applied globally. Meaning, you have to associate a collation with a column or en expression with COLLATE.

Re: Case Insensitive

2019-03-28 Thread Shreeyansh Dba
Hi Sridhar, There are a few workarounds available, hope this will help you. 1) Use the citext extension 2) Use ILIKE instead of LIKE 3) Use Postgres lower() function 4) Add an index on lower(ename) Thanks & Regards, *Shreeyansh DBA Team* www.shreeyansh.com On Thu, Mar 28, 2019 at 1:50 PM Sridh

Re: Case Insensitive

2019-03-28 Thread Brad Nicholson
Andreas Kretschmer wrote on 03/28/2019 07:28:53 AM: > > > > Ummm... Will it use an index (a BTree index)? > > > > test=# explain select * from emp where ename = 'aaa'; > QUERY PLAN > - >  Seq Scan on emp  (cost=0.00..25.

Re: Case Insensitive

2019-03-28 Thread Tim Clarke
On 28/03/2019 11:10, Andy Anderson wrote: Would this also select characters with diacritical marks? For example, eid | ename -+--- 1 | aaa 2 | AAA 3 | áäâ 4 | āåȧ — Andy For that you need https://www.postgresql.org/docs/10/unaccent.html Tim Clarke Main: +44 (0)1376 503

Re: Case Insensitive

2019-03-28 Thread Andreas Kretschmer
Am 28.03.19 um 09:33 schrieb Sameer Kumar: test=*# select * from emp where ename = 'aaa';   eid | ename -+---     1 | aaa     2 | AAA (2 rows) Ummm... Will it use an index (a BTree index)? test=# explain select * from emp where ename = 'aaa';

Re: Case Insensitive

2019-03-28 Thread Andy Anderson
Would this also select characters with diacritical marks? For example, eid | ename -+--- 1 | aaa 2 | AAA 3 | áäâ 4 | āåȧ — Andy > On Mar 28, 2019, at 4:26 AM, Ben Madin wrote: > > Or you can just use `ilike`: > > SELECT * FROM emp WHERE ename ilike 'aaa'; > > https://www.

Re: Case Insensitive

2019-03-28 Thread Steve Atkins
> On Mar 28, 2019, at 9:08 AM, Ron wrote: > > On 3/28/19 3:33 AM, Steve Atkins wrote: >> >>> On Mar 28, 2019, at 8:29 AM, Ron wrote: >>> >>> On 3/28/19 3:23 AM, Sameer Kumar wrote: >>> [snip] You can write a query with upper function: select * from emp where upper(ename)=upp

Re: Case Insensitive

2019-03-28 Thread Peter Eisentraut
On 2019-03-28 09:20, Sridhar N Bamandlapally wrote: > Can we achieve CASE INSENSITIVE in PostgreSQL? Use the citext extension. In PostgreSQL 12, there will be support for case-insensitive collations. -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Suppo

Re: Case Insensitive

2019-03-28 Thread Ron
On 3/28/19 3:33 AM, Steve Atkins wrote: On Mar 28, 2019, at 8:29 AM, Ron wrote: On 3/28/19 3:23 AM, Sameer Kumar wrote: [snip] You can write a query with upper function: select * from emp where upper(ename)=upper('aaa'); That's a guaranteed table scan. Unless you have an index on upper(en

Re: Case Insensitive

2019-03-28 Thread Sridhar N Bamandlapally
With ILIKE or extension CITEXT, does it have any impact on Indexes, like not picking index ? ILIKE works only for operator LIKE not for operator = CITEXT seems some possibilities, Thanks Sridhar On Thu, Mar 28, 2019 at 2:07 PM Sameer Kumar wrote: > > > On Thu, 28 Mar, 2019, 4:33 PM Steve Atk

Re: Case Insensitive

2019-03-28 Thread Sameer Kumar
On Thu, 28 Mar, 2019, 4:33 PM Steve Atkins, wrote: > > > > On Mar 28, 2019, at 8:29 AM, Ron wrote: > > > > On 3/28/19 3:23 AM, Sameer Kumar wrote: > > [snip] > >> You can write a query with upper function: > >> > >> select * from emp where upper(ename)=upper('aaa'); > > > > That's a guaranteed t

Re: Case Insensitive

2019-03-28 Thread Steve Atkins
> On Mar 28, 2019, at 8:29 AM, Ron wrote: > > On 3/28/19 3:23 AM, Sameer Kumar wrote: > [snip] >> You can write a query with upper function: >> >> select * from emp where upper(ename)=upper('aaa'); > > That's a guaranteed table scan. Unless you have an index on upper(ename). Cheers, Stev

Re: Case Insensitive

2019-03-28 Thread Sameer Kumar
On Thu, 28 Mar, 2019, 4:28 PM Andreas Kretschmer, wrote: > > > Am 28.03.19 um 09:20 schrieb Sridhar N Bamandlapally: > > Hi PG-General and Pgsql-Admin > > > > Can we achieve CASE INSENSITIVE in PostgreSQL? > > test=# create extension citext; > CREATE EXTENSION > test=*# create table emp (eid int,

Re: Case Insensitive

2019-03-28 Thread Ron
On 3/28/19 3:23 AM, Sameer Kumar wrote: [snip] You can write a query with upper function: select * from emp where upper(ename)=upper('aaa'); That's a guaranteed table scan. -- Angular momentum makes the world go 'round.

Re: Case Insensitive

2019-03-28 Thread Andreas Kretschmer
Am 28.03.19 um 09:20 schrieb Sridhar N Bamandlapally: Hi PG-General and Pgsql-Admin Can we achieve CASE INSENSITIVE in PostgreSQL? test=# create extension citext; CREATE EXTENSION test=*# create table emp (eid int, ename citext); CREATE TABLE test=*# insert into emp values (1, 'aaa'); INSER

Re: Case Insensitive

2019-03-28 Thread Murtuza Zabuawala
On Thu, Mar 28, 2019 at 1:50 PM Sridhar N Bamandlapally < sridhar@gmail.com> wrote: > Hi PG-General and Pgsql-Admin > > Can we achieve CASE INSENSITIVE in PostgreSQL? > You can try *select * from emp where ename *ILIKE *'aaa';* > > I mean, need below way > > postgres=# select * from emp; >

Re: Case Insensitive

2019-03-28 Thread Ben Madin
Or you can just use `ilike`: SELECT * FROM emp WHERE ename ilike 'aaa'; https://www.postgresql.org/docs/10/sql-select.html#SQL-WHERE cheers Ben On Thu, 28 Mar 2019 at 16:24, Sameer Kumar wrote: > > > On Thu, 28 Mar, 2019, 4:20 PM Sridhar N Bamandlapally, < > sridhar@gmail.com> wrote: > >

Re: Case Insensitive

2019-03-28 Thread Sameer Kumar
On Thu, 28 Mar, 2019, 4:20 PM Sridhar N Bamandlapally, < sridhar@gmail.com> wrote: > Hi PG-General and Pgsql-Admin > > Can we achieve CASE INSENSITIVE in PostgreSQL? > You are perhaps migrating from another RDBMS where this kind of feature is considered a feature. > I mean, need below way