public inbox for pgsql-general@postgresql.org  
help / color / mirror / Atom feed
Choosing default collation/ctype
2+ messages / 2 participants
[nested] [flat]

* Choosing default collation/ctype
@ 2026-05-03 19:52 Igor Korot <ikorot01@gmail.com>
  2026-05-06 06:05 ` Re: Choosing default collation/ctype Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 1 reply; 2+ messages in thread

From: Igor Korot @ 2026-05-03 19:52 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

Hi, ALL,
In the CREATE DATABASE statement I can use encoding/collation/ctype.

I can retrieve the encoding list with:

[code]
SELECT pg_encoding_to_char( conforencoding ) AS name FROM pg_conversion
[/code]

And then I can get a list of collations/ctypes with:

[code]
SELECT collname, collencoding, collprovider collctype FROM pg_collation
[/code]

And then add a logic in my UI to switch collations/ctypes based on encoding.

However, what I wonder is:

Is there a way to select a default collation/ctype for a specific encoding?

Or maybe I'm overthinking it and I should let the user choose and if
nothing - just keep those 2 as "Default" and let the server pick it
up. However it will be weird, especially from me as a user POV.

Please advise.

Thank you.






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

* Re: Choosing default collation/ctype
  2026-05-03 19:52 Choosing default collation/ctype Igor Korot <ikorot01@gmail.com>
@ 2026-05-06 06:05 ` Peter Eisentraut <peter@eisentraut.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Peter Eisentraut @ 2026-05-06 06:05 UTC (permalink / raw)
  To: Igor Korot <ikorot01@gmail.com>; pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

On 03.05.26 21:52, Igor Korot wrote:
> Is there a way to select a default collation/ctype for a specific encoding?
> 
> Or maybe I'm overthinking it and I should let the user choose and if
> nothing - just keep those 2 as "Default" and let the server pick it
> up. However it will be weird, especially from me as a user POV.

There is no default collation/ctype (locale) for an encoding, only the 
other way around.  So if a user picks as locale, let's say, de_DE@euro, 
then the encoding is automatically LATIN9 (obsolete), if the locale is 
de_DE.utf8, then the encoding is UTF8, and so on.







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


end of thread, other threads:[~2026-05-06 06:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-05-03 19:52 Choosing default collation/ctype Igor Korot <ikorot01@gmail.com>
2026-05-06 06:05 ` Peter Eisentraut <peter@eisentraut.org>

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