pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #5801: characters not encoded properly for column names
9+ messages / 4 participants
[nested] [flat]
* BUG #5801: characters not encoded properly for column names
@ 2010-12-23 10:18 Marc Cousin <cousinmarc@gmail.com>
0 siblings, 2 replies; 9+ messages in thread
From: Marc Cousin @ 2010-12-23 10:18 UTC (permalink / raw)
To: pgsql-bugs
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.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-23 10:24 Pavel Stehule <pavel.stehule@gmail.com>
parent: Marc Cousin <cousinmarc@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Pavel Stehule @ 2010-12-23 10:24 UTC (permalink / raw)
To: Marc Cousin <cousinmarc@gmail.com>; +Cc: pgsql-bugs
Hello Marc,
It was entered from a windows cmd console? It doesn't use win
encodings as default. For example, it must be executed with parameter
/c chcp 1250 for win1250 encoding.
Regards
Pavel Stehule
2010/12/23 Marc Cousin <cousinmarc@gmail.com>:
>
> 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.
>
> --
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-23 10:34 Marc Cousin <cousinmarc@gmail.com>
parent: Pavel Stehule <pavel.stehule@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Marc Cousin @ 2010-12-23 10:34 UTC (permalink / raw)
To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-bugs
No, from a Linux psql client (inside a kde konsole). You can setup any charset
in it. I have exactly the same behaviour with psql under windows anyway, with
a chcp 1252 in the cmd console. It's not a console charset problem, I've
tripled checked that :)
And anyway, this character shouldn't get into the database as UTF8, as it is
1252 (hence the error message).
The Thursday 23 December 2010 11:24:21, Pavel Stehule wrote :
> Hello Marc,
>
> It was entered from a windows cmd console? It doesn't use win
> encodings as default. For example, it must be executed with parameter
> /c chcp 1250 for win1250 encoding.
>
> Regards
>
> Pavel Stehule
>
> 2010/12/23 Marc Cousin <cousinmarc@gmail.com>:
> > 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.
> >
> > --
> > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-23 17:21 John R Pierce <pierce@hogranch.com>
parent: Marc Cousin <cousinmarc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: John R Pierce @ 2010-12-23 17:21 UTC (permalink / raw)
To: Marc Cousin <cousinmarc@gmail.com>; +Cc: Pavel Stehule <pavel.stehule@gmail.com>; pgsql-bugs
On 12/23/10 2:34 AM, Marc Cousin wrote:
> No, from a Linux psql client (inside a kde konsole). You can setup any charset
> in it. I have exactly the same behaviour with psql under windows anyway, with
> a chcp 1252 in the cmd console. It's not a console charset problem, I've
> tripled checked that :)
>
> And anyway, this character shouldn't get into the database as UTF8, as it is
> 1252 (hence the error message).
does client_encoding affect names ? (I'm asking because I have no idea).
what encodings are the database clusters on the two platforms?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-23 17:29 Marc Cousin <cousinmarc@gmail.com>
parent: John R Pierce <pierce@hogranch.com>
0 siblings, 0 replies; 9+ messages in thread
From: Marc Cousin @ 2010-12-23 17:29 UTC (permalink / raw)
To: John R Pierce <pierce@hogranch.com>; +Cc: Pavel Stehule <pavel.stehule@gmail.com>; pgsql-bugs
Le jeudi 23 décembre 2010 18:21:55, John R Pierce a écrit :
> On 12/23/10 2:34 AM, Marc Cousin wrote:
> > No, from a Linux psql client (inside a kde konsole). You can setup any
> > charset in it. I have exactly the same behaviour with psql under windows
> > anyway, with a chcp 1252 in the cmd console. It's not a console charset
> > problem, I've tripled checked that :)
> >
> > And anyway, this character shouldn't get into the database as UTF8, as it
> > is 1252 (hence the error message).
>
> does client_encoding affect names ? (I'm asking because I have no idea).
Yes (for the Linux server, for Windows it fails).
I have exactly the same problem if I test with LATIN9 (except that the utf8
error message has a different value for the bad character).
>
> what encodings are the database clusters on the two platforms?
Oh. Both are UTF-8.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-27 21:56 Robert Haas <robertmhaas@gmail.com>
parent: Marc Cousin <cousinmarc@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Robert Haas @ 2010-12-27 21:56 UTC (permalink / raw)
To: Marc Cousin <cousinmarc@gmail.com>; +Cc: pgsql-bugs
On Thu, Dec 23, 2010 at 5:18 AM, Marc Cousin <cousinmarc@gmail.com> wrote:
> With the Windows server :
> test=# SET client_encoding TO 'win1252';
> SET
I have a vague recollection that the argument to SET client_encoding
isn't validated on Windows, and if you enter a value that it doesn't
like it simply silently doesn't work. Am I wrong? What happens if
you do:
SET client_encoding TO
'some_really_long_string_that_is_almost_certainly_not_a_valid_encoding';
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-28 09:01 Marc Cousin <cousinmarc@gmail.com>
parent: Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Marc Cousin @ 2010-12-28 09:01 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-bugs
2010/12/27 Robert Haas <robertmhaas@gmail.com>:
> On Thu, Dec 23, 2010 at 5:18 AM, Marc Cousin <cousinmarc@gmail.com> wrote:
>> With the Windows server :
>> test=# SET client_encoding TO 'win1252';
>> SET
>
> I have a vague recollection that the argument to SET client_encoding
> isn't validated on Windows, and if you enter a value that it doesn't
> like it simply silently doesn't work. Am I wrong? What happens if
> you do:
>
> SET client_encoding TO
> 'some_really_long_string_that_is_almost_certainly_not_a_valid_encoding';
Here it is…
postgres=# SET client_encoding TO 'foo';
ERROR: invalid value for parameter "client_encoding": "foo"
(It does the same with your really long string by the way :) )
Seems validated to me ?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2010-12-28 11:49 Robert Haas <robertmhaas@gmail.com>
parent: Marc Cousin <cousinmarc@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Robert Haas @ 2010-12-28 11:49 UTC (permalink / raw)
To: Marc Cousin <cousinmarc@gmail.com>; +Cc: pgsql-bugs
On Tue, Dec 28, 2010 at 4:01 AM, Marc Cousin <cousinmarc@gmail.com> wrote:
> 2010/12/27 Robert Haas <robertmhaas@gmail.com>:
>> On Thu, Dec 23, 2010 at 5:18 AM, Marc Cousin <cousinmarc@gmail.com> wrote:
>>> With the Windows server :
>>> test=# SET client_encoding TO 'win1252';
>>> SET
>>
>> I have a vague recollection that the argument to SET client_encoding
>> isn't validated on Windows, and if you enter a value that it doesn't
>> like it simply silently doesn't work. Am I wrong? What happens if
>> you do:
>>
>> SET client_encoding TO
>> 'some_really_long_string_that_is_almost_certainly_not_a_valid_encoding';
>
> Here it is…
>
> postgres=# SET client_encoding TO 'foo';
> ERROR: invalid value for parameter "client_encoding": "foo"
>
> (It does the same with your really long string by the way :) )
>
> Seems validated to me ?
Hrm, OK. Well, you just used up my one guess. :-(
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: BUG #5801: characters not encoded properly for column names
@ 2011-01-03 14:04 Marc Cousin <cousinmarc@gmail.com>
parent: Robert Haas <robertmhaas@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Marc Cousin @ 2011-01-03 14:04 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-bugs
The Tuesday 28 December 2010 12:49:20, Robert Haas wrote :
> On Tue, Dec 28, 2010 at 4:01 AM, Marc Cousin <cousinmarc@gmail.com> wrote:
> > 2010/12/27 Robert Haas <robertmhaas@gmail.com>:
> >> On Thu, Dec 23, 2010 at 5:18 AM, Marc Cousin <cousinmarc@gmail.com>
wrote:
> >>> With the Windows server :
> >>> test=# SET client_encoding TO 'win1252';
> >>> SET
> >>
> >> I have a vague recollection that the argument to SET client_encoding
> >> isn't validated on Windows, and if you enter a value that it doesn't
> >> like it simply silently doesn't work. Am I wrong? What happens if
> >> you do:
> >>
> >> SET client_encoding TO
> >> 'some_really_long_string_that_is_almost_certainly_not_a_valid_encoding';
> >
> > Here it is…
> >
> > postgres=# SET client_encoding TO 'foo';
> > ERROR: invalid value for parameter "client_encoding": "foo"
> >
> > (It does the same with your really long string by the way :) )
> >
> > Seems validated to me ?
>
> Hrm, OK. Well, you just used up my one guess. :-(
Sorry about that. Anyone else wanting to take a guess ? :)
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2011-01-03 14:04 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-12-23 10:18 BUG #5801: characters not encoded properly for column names Marc Cousin <cousinmarc@gmail.com>
2010-12-23 10:24 ` Pavel Stehule <pavel.stehule@gmail.com>
2010-12-23 10:34 ` Marc Cousin <cousinmarc@gmail.com>
2010-12-23 17:21 ` John R Pierce <pierce@hogranch.com>
2010-12-23 17:29 ` Marc Cousin <cousinmarc@gmail.com>
2010-12-27 21:56 ` Robert Haas <robertmhaas@gmail.com>
2010-12-28 09:01 ` Marc Cousin <cousinmarc@gmail.com>
2010-12-28 11:49 ` Robert Haas <robertmhaas@gmail.com>
2011-01-03 14:04 ` Marc Cousin <cousinmarc@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox