dbTalk Databases Forums  

[BUGS] BUG #2319: psql utf8/latin1 client_encoding bug when using '-c'

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2319: psql utf8/latin1 client_encoding bug when using '-c' in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mattias Kregert
 
Posts: n/a

Default [BUGS] BUG #2319: psql utf8/latin1 client_encoding bug when using '-c' - 03-15-2006 , 05:02 PM







The following bug has been logged online:

Bug reference: 2319
Logged by: Mattias Kregert
Email address: mattias (AT) kregert (DOT) se
PostgreSQL version: 8.1.0
Operating system: Linux 2.4
Description: psql utf8/latin1 client_encoding bug when using '-c'
Details:

Psql '-c' does not work when using client_encoding.

Example:
Server has encoding UTF8, client has encoding latin1

-- This works...
% psql -h server mydb
mydb=# set client_encoding to 'latin1';
mydb=# select * from mytable where text='ÅÄÖ';

-- ...but this does not.
% psql -h server mydb -c "set client_encoding to 'latin1'; select * from
mytable where text='ÅÄÖ';"
ERROR: invalid UTF-8 byte sequence detected near byte 0xc5

I tried this too, without success:
% psql --set encoding=latin1 -h server mydb ...

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2319: psql utf8/latin1 client_encoding bug when using '-c' - 03-15-2006 , 06:57 PM






"Mattias Kregert" <mattias (AT) kregert (DOT) se> writes:
Quote:
-- ...but this does not.
% psql -h server mydb -c "set client_encoding to 'latin1'; select * from
mytable where text='ÅÄÖ';"
ERROR: invalid UTF-8 byte sequence detected near byte 0xc5
There is no hope of that ever working, since the string will be read (and
converted to the server's encoding if relevant) before the SET is
executed. Better find another way to do what you want.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.