pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Strange collation names ("hu_HU.UTF-8")
3+ messages / 3 participants
[nested] [flat]

* Strange collation names ("hu_HU.UTF-8")
@ 2022-08-02 12:18 Durumdara <durumdara@gmail.com>
  2022-08-02 13:43 ` Re: Strange collation names ("hu_HU.UTF-8") Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Durumdara @ 2022-08-02 12:18 UTC (permalink / raw)
  To: pgsql-general

Dear Members!

Today we found strange database collation names in a server (V11).

select -- datname,
       distinct datcollate
from pg_database
order by datcollate --, datname;

"hu_HU.UTF-8"
"hu_HU.UTF8"
"hu_HU.utf8"


The PGAdmin also gives us these possible collations in the dialog.
Some of the databases were migrated from 9.6 by Python script, and we used
   "hu_HU.UTF-8"
to create the empty databases before restoring them.

What I don't understand, that if I query for collations, I got only this:

SELECT *
FROM pg_collation
where upper(collname) like '%HU%' -- and upper(collname) like '%UTF%'
order by collname

hu_HU.utf8


This collation ("hu_HU.UTF-8") doesn't cause any problems, and PGSQL V11
accepts it.

The whole problem appeared when we wanted to copy a database to a new (with
defining the old as template).

*Error: new collation (hu_HU.utf8) is incompatible with the collation of
the template database (hu_HU.UTF-8)*


So maybe the UTF-8 isn't valid but the PG accepted that???
Or is it valid and inherited from 9.6?

Please help me a little bit! Thank you!

Best regards
dd

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

* Re: Strange collation names ("hu_HU.UTF-8")
  2022-08-02 12:18 Strange collation names ("hu_HU.UTF-8") Durumdara <durumdara@gmail.com>
@ 2022-08-02 13:43 ` Tom Lane <tgl@sss.pgh.pa.us>
  2022-08-03 02:49   ` Re: Strange collation names ("hu_HU.UTF-8") Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2022-08-02 13:43 UTC (permalink / raw)
  To: Durumdara <durumdara@gmail.com>; +Cc: pgsql-general

Durumdara <durumdara@gmail.com> writes:
> Today we found strange database collation names in a server (V11).

> "hu_HU.UTF-8"
> "hu_HU.UTF8"
> "hu_HU.utf8"

Yeah, these are all the same so far as the operating system is
concerned.  I believe most if not all variants of Unix are
permissive about the spelling of the encoding part.

> What I don't understand, that if I query for collations, I got only this:
> hu_HU.utf8

pg_collation generally contains only "canonical" spellings of the locale
names, because initdb builds it from what "locale -a" prints.  However,
different OS releases may have different ideas about which encoding name
is canonical.

> The whole problem appeared when we wanted to copy a database to a new (with
> defining the old as template).
> *Error: new collation (hu_HU.utf8) is incompatible with the collation of
> the template database (hu_HU.UTF-8)*

The code that checks that isn't as permissive as libc.  You can spell
it exactly the same, or if you wanted to live dangerously you could
manually update the template database's pg_database entry to use the
currently-canonical spelling.  (I'd try that in a scratch installation
first ...)

There was some discussion not long ago about relaxing the check
for "same collation name" [1], but no one has written a patch.

			regards, tom lane

[1] https://www.postgresql.org/message-id/flat/fedc0205-c15b-e400-aa3f-e1d2a1285ddb%40sourcepole.ch





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

* Re: Strange collation names ("hu_HU.UTF-8")
  2022-08-02 12:18 Strange collation names ("hu_HU.UTF-8") Durumdara <durumdara@gmail.com>
  2022-08-02 13:43 ` Re: Strange collation names ("hu_HU.UTF-8") Tom Lane <tgl@sss.pgh.pa.us>
@ 2022-08-03 02:49   ` Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2022-08-03 02:49 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Durumdara <durumdara@gmail.com>; pgsql-general

On Wed, Aug 3, 2022 at 1:43 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I believe most if not all variants of Unix are
> permissive about the spelling of the encoding part.

I've only seen glibc doing that downcase-and-strip-hyphens thing to
the codeset part of a locale name when looking for locale definition
files.  Other systems like FreeBSD expect to be able to open
/usr/share/locale/$LC_COLLATE/LC_COLLATE directly without any kind of
munging.  On a Mac it's probably a little fuzzy because the filenames
are case insensitive...





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


end of thread, other threads:[~2022-08-03 02:49 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 12:18 Strange collation names ("hu_HU.UTF-8") Durumdara <durumdara@gmail.com>
2022-08-02 13:43 ` Tom Lane <tgl@sss.pgh.pa.us>
2022-08-03 02:49   ` Thomas Munro <thomas.munro@gmail.com>

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