On 29 June 2017 at 09:44, Craig Ringer <cr...@2ndquadrant.com> wrote:
> I > can't personally think of much right away that wouldn't work pretty > well in a follow-on message. Actually, I take that back, there's one thing that's bugged me for a while that wouldn't work well this way: determining the correct text encoding with which to interpret the database name, user name, and any string GUC values. Right now we take a wild stab in the dark and use the server encoding. e.g. in a terminal with LC_ALL=en_US.UTF-8 I run postgres=# CREATE ROLE "café"; CREATE ROLE postgres=# CREATE DATABASE "café" with owner "café"; CREATE DATABASE postgres=# \du ca* List of roles Role name | Attributes | Member of -----------+--------------+----------- café | Cannot login | {} postgres=# \l ca* List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ------+-------+----------+-------------+-------------+------------------- café | café | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 | (1 row) then in a terminal with LC_ALL=en_US.ISO-8859-1 I run: [craig@ayaki-localdomain log]$ psql -U "café" psql: FATAL: role "café" does not exist [craig@ayaki-localdomain log]$ psql psql (9.6.3, server 9.5.7) Type "help" for help. craig=> \du ca* List of roles Role name | Attributes | Member of -----------+--------------+----------- café | Cannot login | {} craig=> \l ca* List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges ------+-------+----------+-------------+-------------+------------------- café | café | UTF8 | en_AU.UTF-8 | en_AU.UTF-8 | (1 row) craig=> \c café FATAL: database "café" does not exist Previous connection kept Um, say what? This happens because psql does server=>client encoding conversion once connected, but there's no way to convert the startup message with the username. That IMO is an argument to allow startup message format change. (It'd also then let the server reply with correctly-encoded pre-auth messages for errors, something we currently fail to do). -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers