pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Add support for collation attributes on older ICU versions
4+ messages / 3 participants
[nested] [flat]

* pgsql: Add support for collation attributes on older ICU versions
@ 2019-03-17 07:47 Peter Eisentraut <peter@eisentraut.org>
  2019-03-18 19:03 ` Re: pgsql: Add support for collation attributes on older ICU versions Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2019-03-17 07:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Add support for collation attributes on older ICU versions

Starting in ICU 54, collation customization attributes can be
specified in the locale string, for example
"@colStrength=primary;colCaseLevel=yes".  Add support for this for
older ICU versions as well, by adding some minimal parsing of the
attributes in the locale string and calling ucol_setAttribute() on
them.  This is essentially what never ICU versions do internally in
ucol_open().  This was we can offer this functionality in a consistent
way in all ICU versions supported by PostgreSQL.

Also add some tests for ICU collation customization.

Reported-by: Daniel Verite <daniel@manitou-mail.org>
Discussion: https://www.postgresql.org/message-id/0270ebd4-f67c-8774-1a5a-91adfb9bb41f@2ndquadrant.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b8f9a2a69a279d118e366a0d3d45caa84a7620b1

Modified Files
--------------
src/backend/utils/adt/pg_locale.c              | 104 +++++++++++++++++++++++++
src/test/regress/expected/collate.icu.utf8.out |  39 ++++++++++
src/test/regress/sql/collate.icu.utf8.sql      |  21 +++++
3 files changed, 164 insertions(+)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Add support for collation attributes on older ICU versions
  2019-03-17 07:47 pgsql: Add support for collation attributes on older ICU versions Peter Eisentraut <peter@eisentraut.org>
@ 2019-03-18 19:03 ` Andres Freund <andres@anarazel.de>
  2019-03-19 08:49   ` Re: pgsql: Add support for collation attributes on older ICU versions Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Andres Freund @ 2019-03-18 19:03 UTC (permalink / raw)
  To: Peter Eisentraut <peter@eisentraut.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi,

On 2019-03-17 07:47:45 +0000, Peter Eisentraut wrote:
> Add support for collation attributes on older ICU versions
> 
> Starting in ICU 54, collation customization attributes can be
> specified in the locale string, for example
> "@colStrength=primary;colCaseLevel=yes".  Add support for this for
> older ICU versions as well, by adding some minimal parsing of the
> attributes in the locale string and calling ucol_setAttribute() on
> them.  This is essentially what never ICU versions do internally in
> ucol_open().  This was we can offer this functionality in a consistent
> way in all ICU versions supported by PostgreSQL.
> 
> Also add some tests for ICU collation customization.
> 
> Reported-by: Daniel Verite <daniel@manitou-mail.org>
> Discussion: https://www.postgresql.org/message-id/0270ebd4-f67c-8774-1a5a-91adfb9bb41f@2ndquadrant.com

I now get this warning:

/home/andres/src/postgresql/src/backend/utils/adt/pg_locale.c:1680:14: warning: comparison of constant -1 with expression of type 'UColAttribute' is always true [-Wtautological-constant-out-of-range-compare]
                        if (uattr != -1 && uvalue != -1)
                            ~~~~~ ^  ~~


Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Add support for collation attributes on older ICU versions
  2019-03-17 07:47 pgsql: Add support for collation attributes on older ICU versions Peter Eisentraut <peter@eisentraut.org>
  2019-03-18 19:03 ` Re: pgsql: Add support for collation attributes on older ICU versions Andres Freund <andres@anarazel.de>
@ 2019-03-19 08:49   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
  2019-03-19 15:32     ` Re: pgsql: Add support for collation attributes on older ICU versions Andres Freund <andres@anarazel.de>
  0 siblings, 1 reply; 4+ messages in thread

From: Peter Eisentraut @ 2019-03-19 08:49 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org

On 2019-03-18 20:03, Andres Freund wrote:
> I now get this warning:
> 
> /home/andres/src/postgresql/src/backend/utils/adt/pg_locale.c:1680:14: warning: comparison of constant -1 with expression of type 'UColAttribute' is always true [-Wtautological-constant-out-of-range-compare]
>                         if (uattr != -1 && uvalue != -1)
>                             ~~~~~ ^  ~~

I found a bug in that code and restructured it a bit.  It should also
avoid this warning now.

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




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: pgsql: Add support for collation attributes on older ICU versions
  2019-03-17 07:47 pgsql: Add support for collation attributes on older ICU versions Peter Eisentraut <peter@eisentraut.org>
  2019-03-18 19:03 ` Re: pgsql: Add support for collation attributes on older ICU versions Andres Freund <andres@anarazel.de>
  2019-03-19 08:49   ` Re: pgsql: Add support for collation attributes on older ICU versions Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
@ 2019-03-19 15:32     ` Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 4+ messages in thread

From: Andres Freund @ 2019-03-19 15:32 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>; +Cc: pgsql-committers@lists.postgresql.org

On 2019-03-19 09:49:14 +0100, Peter Eisentraut wrote:
> On 2019-03-18 20:03, Andres Freund wrote:
> > I now get this warning:
> > 
> > /home/andres/src/postgresql/src/backend/utils/adt/pg_locale.c:1680:14: warning: comparison of constant -1 with expression of type 'UColAttribute' is always true [-Wtautological-constant-out-of-range-compare]
> >                         if (uattr != -1 && uvalue != -1)
> >                             ~~~~~ ^  ~~
> 
> I found a bug in that code and restructured it a bit.  It should also
> avoid this warning now.

Thanks.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2019-03-19 15:32 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-17 07:47 pgsql: Add support for collation attributes on older ICU versions Peter Eisentraut <peter@eisentraut.org>
2019-03-18 19:03 ` Andres Freund <andres@anarazel.de>
2019-03-19 08:49   ` Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
2019-03-19 15:32     ` Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox