Обсуждение: encoding and parser: error?

Поиск
Список
Период
Сортировка

encoding and parser: error?

От
Hubert Fröhlich
Дата:
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


Re: encoding and parser: error?

От
Tom Lane
Дата:
=?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