copy from problem

Started by Mark Watsonover 15 years ago6 messagesgeneral
Jump to latest
#1Mark Watson
mark.watson@jurisconcept.ca
Hello all,
(Postgres 8.4.6 Windows)
I am stumped as to why I cannot import this using copy from within pgadmin
(the following table is created in an existing database with an encoding of
WIN1252 and the Postgres server_encoding is UTF8) :
CREATE TABLE test
(
  col_descr text
)
WITH (
  OIDS=FALSE
);
ALTER TABLE test OWNER TO postgres;
set client_encoding = 'WIN1252';
COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
select * from test;
--- col_descr
-- ----------------
--                 (empty row)

The file test.txt contains 1 line of 2 characters: éÉ (acute accented
lowercase and uppercase e, hex(E9C9), valid win1252 characters.

Any help would be appreciated.
Mark

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Mark Watson (#1)
Re: copy from problem

On Wednesday 22 December 2010 12:34:58 pm Mark Watson wrote:

Hello all,
(Postgres 8.4.6 Windows)
I am stumped as to why I cannot import this using copy from within pgadmin
(the following table is created in an existing database with an encoding of
WIN1252 and the Postgres server_encoding is UTF8) :
CREATE TABLE test
(
col_descr text
)
WITH (
OIDS=FALSE
);
ALTER TABLE test OWNER TO postgres;
set client_encoding = 'WIN1252';
COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
select * from test;
--- col_descr
-- ----------------
--                 (empty row)

The file test.txt contains 1 line of 2 characters: éÉ (acute accented
lowercase and uppercase e, hex(E9C9), valid win1252 characters.

Any help would be appreciated.
Mark

Is there anything in the database logs? Are the two characters separated by '|'?

--
Adrian Klaver
adrian.klaver@gmail.com

#3Guillaume Lelarge
guillaume@lelarge.info
In reply to: Mark Watson (#1)
Re: copy from problem

Le 22/12/2010 21:34, Mark Watson a �crit :

Hello all,
(Postgres 8.4.6 Windows)
I am stumped as to why I cannot import this using copy from within pgadmin
(the following table is created in an existing database with an encoding of
WIN1252 and the Postgres server_encoding is UTF8) :
CREATE TABLE test
(
col_descr text
)
WITH (
OIDS=FALSE
);
ALTER TABLE test OWNER TO postgres;
set client_encoding = 'WIN1252';
COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
select * from test;
--- col_descr
-- ----------------
--                 (empty row)

The file test.txt contains 1 line of 2 characters: �� (acute accented
lowercase and uppercase e, hex(E9C9), valid win1252 characters.

Any help would be appreciated.

It would be so much easier if you told us your error message.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

#4Mark Watson
mark.watson@jurisconcept.ca
In reply to: Guillaume Lelarge (#3)
Re: copy from problem

Le 22/12/2010 21:34, Mark Watson a écrit :

Hello all,
(Postgres 8.4.6 Windows)
I am stumped as to why I cannot import this using copy from within pgadmin
(the following table is created in an existing database with an encoding

of

WIN1252 and the Postgres server_encoding is UTF8) :
CREATE TABLE test
(
   col_descr text
)
WITH (
   OIDS=FALSE
);
ALTER TABLE test OWNER TO postgres;
set client_encoding = 'WIN1252';
COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
select * from test;
--- col_descr
-- ----------------
--                 (empty row)

The file test.txt contains 1 line of 2 characters: éÉ  (acute accented
lowercase and uppercase e, hex(E9C9), valid win1252 characters.

Any help would be appreciated.

It would be so much easier if you told us your error message.

--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com

------------------------------------
Another update :
After toying around with this, I think this is a subject for the PgAdmin
list. It looks like a display problem in pgAdmin. The characters are being
displayed with a client_encoding of UTF8 but not with a client_encoding of
WIN1252. My application, which sets client_encoding to WIN1252, receives and
displays the characters correctly. By the way, my pgAdmin is configured with
Preferences=>Font = Tahoma windows-1252 and Query=>Font = Tahoma 9
windows-1252.

#5Guillaume Lelarge
guillaume@lelarge.info
In reply to: Mark Watson (#4)
Re: copy from problem

Le 23/12/2010 14:36, Mark Watson a �crit :

Le 22/12/2010 21:34, Mark Watson a �crit :

Hello all,
(Postgres 8.4.6 Windows)
I am stumped as to why I cannot import this using copy from within pgadmin
(the following table is created in an existing database with an encoding

of

WIN1252 and the Postgres server_encoding is UTF8) :
CREATE TABLE test
(
col_descr text
)
WITH (
OIDS=FALSE
);
ALTER TABLE test OWNER TO postgres;
set client_encoding = 'WIN1252';
COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
select * from test;
--- col_descr
-- ----------------
--                 (empty row)

The file test.txt contains 1 line of 2 characters: �� (acute accented
lowercase and uppercase e, hex(E9C9), valid win1252 characters.

Any help would be appreciated.

It would be so much easier if you told us your error message.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

------------------------------------
Another update :
After toying around with this, I think this is a subject for the PgAdmin
list. It looks like a display problem in pgAdmin. The characters are being
displayed with a client_encoding of UTF8 but not with a client_encoding of
WIN1252. My application, which sets client_encoding to WIN1252, receives and
displays the characters correctly. By the way, my pgAdmin is configured with
Preferences=>Font = Tahoma windows-1252 and Query=>Font = Tahoma 9
windows-1252.

pgAdmin sets the client encoding to UTF-8 and only displays UTF-8.

--
Guillaume
http://www.postgresql.fr
http://dalibo.com

#6Mark Watson
mark.watson@jurisconcept.ca
In reply to: Guillaume Lelarge (#5)
Re: copy from problem

Le 23/12/2010 14:36, Mark Watson a écrit :

Le 22/12/2010 21:34, Mark Watson a écrit :

Hello all,
(Postgres 8.4.6 Windows)
I am stumped as to why I cannot import this using copy from within

pgadmin

(the following table is created in an existing database with an encoding

of

WIN1252 and the Postgres server_encoding is UTF8) :
CREATE TABLE test
(
    col_descr text
)
WITH (
    OIDS=FALSE
);
ALTER TABLE test OWNER TO postgres;
set client_encoding = 'WIN1252';
COPY test FROM 'C:\\pgtemp\\test.txt' with  delimiter as '|' csv;
select * from test;
--- col_descr
-- ----------------
--                 (empty row)

The file test.txt contains 1 line of 2 characters: éÉ  (acute accented
lowercase and uppercase e, hex(E9C9), valid win1252 characters.

Any help would be appreciated.

It would be so much easier if you told us your error message.

--
Guillaume
  http://www.postgresql.fr
  http://dalibo.com

------------------------------------
Another update :
After toying around with this, I think this is a subject for the PgAdmin
list. It looks like a display problem in pgAdmin. The characters are being
displayed with a client_encoding of UTF8 but not with a client_encoding of
WIN1252. My application, which sets client_encoding to WIN1252, receives

and

displays the characters correctly. By the way, my pgAdmin is configured

with

Preferences=>Font = Tahoma windows-1252 and Query=>Font = Tahoma 9
windows-1252.

pgAdmin sets the client encoding to UTF-8 and only displays UTF-8.

--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com
--------------------------------------------
Thanks, Guillaume! That answers everything. Happy holidays to all!
-Mark