Обсуждение: BUG #10255: CREATE COLLATION bug on 9.4

Поиск
Список
Период
Сортировка

BUG #10255: CREATE COLLATION bug on 9.4

От
emanuel.calvo@2ndquadrant.com
Дата:
The following bug has been logged on the website:

Bug reference:      10255
Logged by:          Emanuel
Email address:      emanuel.calvo@2ndquadrant.com
PostgreSQL version: Unsupported/Unknown
Operating system:   Non related
Description:


When trying to create COLLATIONS, I'm facing some issues:

--- BUG REPORT

postgres=# CREATE COLLATION le_english (LOCALE = "en_US.utf8");
ERROR:  encoding "LATIN1" does not match locale "en_US.utf8"
DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".

Ok, it requires LC_CTYPE. Added it, but:


postgres=# CREATE COLLATION le_english (LOCALE = "en_US.utf8", LC_CTYPE =
"UTF8");
ERROR:  conflicting or redundant options

Oh, wait a minute. Something 's wrong with the locale.

Rewritten with LC_COLLATE:

postgres=# CREATE COLLATION le_english (LC_COLLATE = "UTF8", LC_CTYPE =
"UTF8");
ERROR:  could not create locale "UTF8": Success


This bug was found on 9.4dev.

Re: BUG #10255: CREATE COLLATION bug on 9.4

От
Tom Lane
Дата:
emanuel.calvo@2ndquadrant.com writes:
> When trying to create COLLATIONS, I'm facing some issues:

I see no bugs here, just misunderstanding of the commands.

> postgres=# CREATE COLLATION le_english (LOCALE = "en_US.utf8");
> ERROR:  encoding "LATIN1" does not match locale "en_US.utf8"
> DETAIL:  The chosen LC_CTYPE setting requires encoding "UTF8".

Your current database is using encoding LATIN1, so you need to reference
a locale that matches that, perhaps "en_US.iso88591".  (Hard to be sure
about the exact spelling, since you didn't provide your platform.)

> postgres=# CREATE COLLATION le_english (LOCALE = "en_US.utf8", LC_CTYPE =
> "UTF8");
> ERROR:  conflicting or redundant options

You specify either locale or lc_ctype+lc_collate, not both.

> postgres=# CREATE COLLATION le_english (LC_COLLATE = "UTF8", LC_CTYPE =
> "UTF8");
> ERROR:  could not create locale "UTF8": Success

I get this (on RHEL6):

l1=# CREATE COLLATION le_english (LC_COLLATE = "UTF8", LC_CTYPE = "UTF8");
ERROR:  could not create locale "UTF8": No such file or directory
DETAIL:  The operating system could not find any locale data for the locale name "UTF8".

which is what I'd expect, since it seems unlikely that any platform
would name a locale setting just "UTF8".

What seems likely is that there's something bogus about the locale data on
your machine.  Or maybe there's a platform-specific issue in how PG is
interrogating that data ... but since you did not provide your platform
information, we have no way to investigate that.

            regards, tom lane

Re: BUG #10255: CREATE COLLATION bug on 9.4

От
Andres Freund
Дата:
On 2014-05-07 12:43:46 -0400, Tom Lane wrote:
> emanuel.calvo@2ndquadrant.com writes:
> > postgres=# CREATE COLLATION le_english (LC_COLLATE = "UTF8", LC_CTYPE =
> > "UTF8");
> > ERROR:  could not create locale "UTF8": Success
>
> I get this (on RHEL6):
>
> l1=# CREATE COLLATION le_english (LC_COLLATE = "UTF8", LC_CTYPE = "UTF8");
> ERROR:  could not create locale "UTF8": No such file or directory
> DETAIL:  The operating system could not find any locale data for the locale name "UTF8".

Independent of everything else the 'Success' on Emanuel's suggest that
errno might not be properly handled...

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

Re: BUG #10255: CREATE COLLATION bug on 9.4

От
Emanuel Calvo
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512



El 07/05/14 13:52, Andres Freund escribió:
> On 2014-05-07 12:43:46 -0400, Tom Lane wrote:
>> emanuel.calvo@2ndquadrant.com writes:
>>> postgres=# CREATE COLLATION le_english (LC_COLLATE = "UTF8",
>>> LC_CTYPE = "UTF8"); ERROR:  could not create locale "UTF8":
>>> Success
>>
>> I get this (on RHEL6):
>>
>> l1=# CREATE COLLATION le_english (LC_COLLATE = "UTF8", LC_CTYPE =
>> "UTF8"); ERROR:  could not create locale "UTF8": No such file or
>> directory DETAIL:  The operating system could not find any locale
>> data for the locale name "UTF8".
>
> Independent of everything else the 'Success' on Emanuel's suggest
> that errno might not be properly handled...
>

The same command, on 9.3 gives a different error:
ERROR:  no se pudo crear la configuración regional «UTF8»: No existe
el fichero o el directorio

(file does not exist)


- --
- --
Emanuel Calvo  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Bs. As., Argentina (GMT-3)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIbBAEBCgAGBQJTao/GAAoJEIBeI/HMagHmsOsP+Il/mdpRB7HdiOZSGYmVi3lk
Epp1zQTGWRrPxzsCJ0L9QXhKrYaEcB0AxVMR+czadGmXpWNt26wmuSAAvcU8fKhs
l17BoXIZcYS8HkikypoB90thgLHi/nFkrIWn+zZnD4JVtKnl1XaOK1sW5iojzCLK
pnOaP85aPaFPpicEgD4w7JnqnGJK1IcKd0D1YCLu4emWh8ZchasP4BMHlu7H58Lh
T9RJz/fqQPhFMNeMGM1NbbDw4u4yu6RjxwbCqe4rHqNqge8o1v76MXsqzGLRqhAX
CeEo6o+HrMMQlz9W9xiVr5+Vh98bzn52TdbAKgY6M20wHNAh30o74uHzGKWTAzR5
OA5qbAY2xkqirg4gXNlqBqbjIN+FcU49IvY6zZDmQczfJLAUMc6ByMpH0WaNYt0P
Dj5Lm87lQjESHlPrlsksjSyJy9CIJqBiXNQyvZUmARK1uTHd7I4mj0/W5jcxtwXi
YmjO6uBbjyFJIhwOJAIJS2dIEriYV2Of0FJPGit0AErPF7iogUvIKyi0NbKCBd8F
WbwIdHlbUxcU62/b0oM40Jg8p7IFqat82wzEWE2ofm/vEMlie17cSdCL1PuFUsYz
sHE1zgt85EW5H9yNVJ/Lk9sifYEJey0erkH6pVDMGY9gm8fHdolADlDog9FWYs7J
Q5vR+kCJFS/cMwtL+Ng=
=yzcy
-----END PGP SIGNATURE-----

Re: BUG #10255: CREATE COLLATION bug on 9.4

От
Tom Lane
Дата:
Emanuel Calvo <emanuel.calvo@2ndquadrant.com> writes:
> El 07/05/14 13:52, Andres Freund escribió:
>> Independent of everything else the 'Success' on Emanuel's suggest
>> that errno might not be properly handled...

> The same command, on 9.3 gives a different error:
> ERROR:  no se pudo crear la configuración regional «UTF8»: No existe
> el fichero o el directorio

Well, that's what I'd expect.  But the relevant code
(pg_newlocale_from_collation in pg_locale.c) hasn't changed one bit since
9.3.  And you're not helping any by refusing to divulge what OS you're
testing on.  I'm not in the business of playing guessing games, so I think
it's your turn to do some work and figure out what's different between
your 9.3 and 9.4 cases.

            regards, tom lane

Re: BUG #10255: CREATE COLLATION bug on 9.4

От
Emanuel Calvo
Дата:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512



El 07/05/14 17:28, Tom Lane escribió:
> Emanuel Calvo <emanuel.calvo@2ndquadrant.com> writes:
>> El 07/05/14 13:52, Andres Freund escribió:
>>> Independent of everything else the 'Success' on Emanuel's
>>> suggest that errno might not be properly handled...
>
>> The same command, on 9.3 gives a different error: ERROR:  no se
>> pudo crear la configuración regional «UTF8»: No existe el fichero
>> o el directorio
>
> Well, that's what I'd expect.  But the relevant code
> (pg_newlocale_from_collation in pg_locale.c) hasn't changed one bit
> since 9.3.  And you're not helping any by refusing to divulge what
> OS you're testing on.  I'm not in the business of playing guessing
> games, so I think it's your turn to do some work and figure out
> what's different between your 9.3 and 9.4 cases.
>
> regards, tom lane
>

Give me a couple of hours and I will submit a detailed report. :)

Please, don't misunderstood, there is no need to refuse about divulge
the OS version. I found this when doing other work, I wasn't hunting bugs.

root@precise64:/opt/deparse# uname -a
Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51
UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access
privileges
-
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | LATIN1   | en_US   | en_US |
 template0 | postgres | LATIN1   | en_US   | en_US | =c/postgres
    +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | LATIN1   | en_US   | en_US | =c/postgres
    +
           |          |          |         |       | postgres=CTc/postgres
 test      | postgres | LATIN1   | en_US   | en_US |
(4 rows)


root@precise64:/opt/deparse# locale
LANG=
LANGUAGE=
LC_CTYPE="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_COLLATE="en_US"
LC_MONETARY="en_US"
LC_MESSAGES="en_US"
LC_PAPER="en_US"
LC_NAME="en_US"
LC_ADDRESS="en_US"
LC_TELEPHONE="en_US"
LC_MEASUREMENT="en_US"
LC_IDENTIFICATION="en_US"
LC_ALL=en_US
root@precise64


- --
- --
Emanuel Calvo  http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Bs. As., Argentina (GMT-3)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.18 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCgAGBQJTarK0AAoJEIBeI/HMagHmibYP/0Rc7M1rC1yi3QLEPIbFbzRh
jwuJUZgy8z1Kdvu96lfyyx1OYgEGZUfv6GfUjtpF8v6Y0WgR9a1cMKPLDV/sVlHA
tP5cheTD7Qkf76T7MEmdJkeTuywAnNbxxXLOhV7j/duJBH7cd2xC6ltA9GTOzqZr
C1W23h1Fuh+1GZwATczXLi86E8ZfY+8w6wwI9kBftUPLKitFKpTqlTvQmx3xWAt2
sl7TH5/ttNJB2E50V1PBdH2tYmFM9Wkr7pKj9k+6OLiLVRqCfNuOm/HOBOcXi0WG
sG+icXqFPchDC/vSMTJsMq1nh1dR/DwGh0iB2qj0kpPVooiZTuEMy2lkcij4FqGy
MKstaE/LMaCATbWLbrtJtCrPtN1SMIm79tuY5tX5qOtAIZL/3+GyEavcV9B3UqvZ
6mCHfJIcO4yy63tlUAV1vt1pP/waDquARXkq93hGsVzugBex48g5Zsb5j5yoYVUT
1RveWg9LO5leLfQWUiINloc+84eF7yphAfkKaDBHfZV6fQf5pYAaectF9BrzDNNH
KDzhQDt+qpYxwkSNsQCHjOQ+oIDKzIyMmS5F/lLQydBiUOF0DxpA0Raf+D6sUwO8
vTOUrSd/9Xijl4bhlFdCTHylqNWSo448ou2hnRTXUfwxHj60qI5rxNjLAxHN7iRW
uje/S5P961fY/q88X+Wn
=U1xe
-----END PGP SIGNATURE-----