Re: Support UTF-8 files with BOM in COPY FROM - Mailing list pgsql-hackers

From Brar Piening
Subject Re: Support UTF-8 files with BOM in COPY FROM
Date
Msg-id 4E80CE79.2090405@gmx.de
Whole thread Raw
In response to Re: Support UTF-8 files with BOM in COPY FROM  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Yeah, that's a reasonable argument for rejecting the patch altogether.
> I'm not qualified to decide whether it outweighs the "we need to be able
> to read Notepad output" argument.

Actually it's not only notepad.

I quite often find myself doing something like the following when moving 
data from MSSQL to PostgreSQL.

\echo Fetching data for table "patient"
\! sqlcmd -S DBSERVER -d DATABASE -E -f 65001 -o "C:/datafile.txt" -h -1 
-W -s "|" -Q "SET NOCOUNT ON; SELECT * FROM my_table;"
\! perl -CD -pi.orig -e "tr/\x{feff}//d" "C:/datafile.txt"

\echo Importing data into table "patient"
\copy my_table FROM 'C:/datafile.txt' WITH DELIMITER '|' NULL 'NULL'

Regards,

Brar


pgsql-hackers by date:

Previous
From: Brar Piening
Date:
Subject: Re: Support UTF-8 files with BOM in COPY FROM
Next
From: Josh Kupershmidt
Date:
Subject: Re: psql setenv command