Re: BUG #16020: ICU Collations querys

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Marina Garrido Sanchez <garridosanchezmarina(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16020: ICU Collations querys
Date: 2019-09-26 16:28:39
Message-ID: 2e46edd2-b742-7a7b-1a92-867cf4dea896@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 2019-09-26 17:14, Marina Garrido Sanchez wrote:
> create collation ca_insensitive (provider = icu, locale =
> 'es-ES-u-ks-level1', deterministic = false;
>
> create table users (
> nombre text collate "ca_insensitive" primary key unique,
> apellidos text collate "ca_insensitive",
> direccion text
> );
>
> insert into user values ("jávier", "gonzález", "BBB")
> insert into user values ("Javier", "Gonzalez", "BBB")
>
> and if I do the query:
>
> select * from users where users.apellidos ilike '%Gonz%';
>
> I get the error that *ilike *does not support nondeterministic
> operation, for that, my question is How can I do partial match search
> with case- and accet- insensitive in postgres? or Which operator can I
> use to do the search?

You can run your query with an explicit deterministic collation applied,
for example:

select * from users where users.apellidos ilike '%Gonz%' collate "C";

or "und-x-icu" or whatever.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2019-09-26 16:31:43 Re: BUG #16027: Invalid output of to_timestamp
Previous Message William Burke 2019-09-26 16:15:53 Re: [External] Re: BUG #16023: in PgAdmin4.13, unable to recompile functions that have "search_path" set at the function level