encoding and parser: error?

Started by Hubert Fröhlichover 22 years ago2 messagesgeneral
Jump to latest
#1Hubert Fröhlich
hubert.froehlich@bvv.bayern.de

Hi list

I am working with postgresql 7.1.3 and 7.3.4 and German characters. I
use only unicode databases.

When importing data from iso-latin-1 via psql I tried

drop table test;
create table test(nr int, text1 text, text2 text) ;
set client_encoding to 'latin1';
insert into test values(0,'these are all','German characters');
insert into test values(1,'--','abc�������');
insert into test values(2,'we insert','one German character');
insert into test values(3,'e.g.','�');
insert into test values(4,'we insert','two German character');
insert into test values(5,'e.g.','��');

so far ok, but when I try

insert into test values(6,'we insert','a very special address');
insert into test values(7,'----','6 /6,Basink�y');

I got the prompt like
test1'#
telling me that some ' seems missing.

When I ignore that and continue

insert into test values(8,'again','two German characters');
insert into test values(9,'e.g.','��');
select * from test;

everything seems OK !!

Moreover, when I use the metacommand

/encoding latin1
instead of the "set client_encoding" SQLcommand (which should be
equivalent,
everything goes OK right from the beginning.

Why? Some parser error?

Thank you for your help.

Regards,

Hubert

--
-------------------------------------------------------------------------------
Dr.-Ing. Hubert Fr�hlich
Bezirksfinanzdirektion M�nchen
Alexandrastr. 3, D-80538 M�nchen, GERMANY
Tel. :+49 (0)89 / 2190 - 2980
Fax :+49 (0)89 / 2190 - 2459
hubert.froehlich@bvv.bayern.de

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Hubert Fröhlich (#1)
Re: encoding and parser: error?

=?ISO-8859-1?Q?Hubert_Fr=F6hlich?= <hubert.froehlich@bvv.bayern.de> writes:

Moreover, when I use the metacommand

/encoding latin1
instead of the "set client_encoding" SQLcommand (which should be
equivalent,
everything goes OK right from the beginning.

They should be equivalent, but they are not --- psql needs to know the
encoding, and when you use SET it doesn't. (This is fixed for 7.4.)

regards, tom lane