Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id EFF691C6FE3C for ; Thu, 26 Jan 2012 11:32:16 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RqRJ6-0003oo-L7 for pgsql-hackers@postgresql.org; Thu, 26 Jan 2012 15:32:16 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q0QFVu8v004485; Thu, 26 Jan 2012 10:31:56 -0500 (EST) To: Heikki Linnakangas cc: Jim Mlodgenski , Fujii Masao , pgsql-hackers@postgresql.org Subject: Re: Client Messages In-reply-to: <4F21102A.2080506@enterprisedb.com> References: <4F167E08.9030802@enterprisedb.com> <4F1EA62C.8010203@enterprisedb.com> <4F21102A.2080506@enterprisedb.com> Comments: In-reply-to Heikki Linnakangas message dated "Thu, 26 Jan 2012 10:34:50 +0200" Date: Thu, 26 Jan 2012 10:31:56 -0500 Message-ID: <4484.1327591916@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/1500 X-Sequence-Number: 202087 Heikki Linnakangas 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