Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> The thing is, there's currently no encoding conversion happening, so if
> you have one database in LATIN1 encoding and another in UTF-8, for
> example, whatever you put in your postgresql.conf is going to be wrong
> for one database. I'm happy to just document the issue for per-database
> messages, "ALTER DATABASE ... SET welcome_message", the encoding used
> there need to match the encoding of the database, or it's displayed as
> garbage. But what about per-user messages, when the user has access to
> several databases, or postgresql.conf?
I've not looked at the patch, but what exactly will happen if the string
has the wrong encoding?
The idea that occurs to me is to have the code that uses the GUC do a
verify_mbstr(noerror) on it, and silently ignore it if it doesn't pass
(maybe with a LOG message). This would have to be documented of course,
but it seems better than the potential consequences of trying to send a
wrongly-encoded string.
regards, tom lane