Fix bug in support for collation attributes on older ICU versions
authorPeter Eisentraut <peter@eisentraut.org>
Tue, 19 Mar 2019 08:37:46 +0000 (09:37 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Tue, 19 Mar 2019 08:37:46 +0000 (09:37 +0100)
commit1f050c08f91d866c560344d4510404ecd2763cbf
tree9bbb83d3fd129bd8854a39969f92e8e957e9dafc
parent53680c116ce8c501e4081332d32ba0e93aa1aaa2
Fix bug in support for collation attributes on older ICU versions

Unrecognized attribute names are supposed to be ignored.  But the code
would error out on an unrecognized attribute value even if it did not
recognize the attribute name.  So unrecognized attributes wouldn't
really be ignored unless the value happened to be one that matched a
recognized value.  This would break some important cases where the
attribute would be processed by ucol_open() directly.  Fix that and
add a test case.

The restructured code should also avoid compiler warnings about
initializing a UColAttribute value to -1, because the type might be an
unsigned enum.  (reported by Andres Freund)
src/backend/utils/adt/pg_locale.c
src/test/regress/expected/collate.icu.utf8.out
src/test/regress/sql/collate.icu.utf8.sql