Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 8B65F133798E for ; Thu, 23 Dec 2010 06:18:42 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 58718-10 for ; Thu, 23 Dec 2010 10:18:42 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id C23C113364DE for ; Thu, 23 Dec 2010 06:18:41 -0400 (AST) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id oBNAIfFh020455 for ; Thu, 23 Dec 2010 10:18:41 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id oBNAIfdF020454; Thu, 23 Dec 2010 10:18:41 GMT (envelope-from www) Date: Thu, 23 Dec 2010 10:18:41 GMT Message-Id: <201012231018.oBNAIfdF020454@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5801: characters not encoded properly for column names From: "Marc Cousin" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201012/167 X-Sequence-Number: 28973 The following bug has been logged online: Bug reference: 5801 Logged by: Marc Cousin Email address: cousinmarc@gmail.com PostgreSQL version: 9.0.2 Operating system: Windows XP Description: characters not encoded properly for column names Details: I get a different behaviour between a Linux and a Windows server, when a user creates an accentuated column name. All tests below were done with a linux psql client, the console being set on win1252 charset (so the input character is truly 'é' in win1252) With the Linux server : marc=# SET client_encoding TO 'win1252'; SET marc=# CREATE TABLE test (nom varchar, prénom varchar); CREATE TABLE marc=# \d test Table "public.test" Column | Type | Modifiers --------+-------------------+----------- nom | character varying | prénom | character varying | 'prénom' is also displayed correctly if client_encoding and console are UTF8, so the conversion is good. With the Windows server : test=# SET client_encoding TO 'win1252'; SET test=# CREATE TABLE test (nom varchar, prénom varchar); CREATE TABLE test=# \d test ERROR: invalid byte sequence for encoding "UTF8": 0xe3a96e test=# SELECT attname from pg_attribute where attrelid = (select oid from pg_class where relname = 'test'); ERROR: invalid byte sequence for encoding "UTF8": 0xe3a96e test=# select version(); version ------------------------------------------------------------- PostgreSQL 9.0.2, compiled by Visual C++ build 1500, 32-bit (1 row) The main reason that this is a problem is that the table cannot be pg_dumped anymore because of this.