Search Postgresql Archives

Re: Two small questions re/ COPY CSV data into table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



El día Tuesday, June 04, 2019 a las 11:32:45AM +0100, Andrew Gierth escribió:

>  Matthias> 2. The CSV export is done by some Sybase tool which escapes
>  Matthias> the delimiter as '\|', i.e. putting a backslash before the
>  Matthias> delimiter. I found no way that COPY understands this
>  Matthias> excaping. Any ideas?
> 
> That sounds like the file is not actually a CSV - why do you think it
> is?
> 
> ...

Well, it's not strictly CSV, but it is what the Sybase tool produces. The
delimiter is set to '|' and a data example line looks like:

0|1| cat $1 \| lpr -Pprinter |3|4

I do load this now with COPY in mode TEXT and modify the data before
with:

 sed 's/|/\v/g' < table-from-Sybase  | sed 's/\\\v/|/g' > table-for-copy

Works fine.

	matthias

-- 
Matthias Apitz, ✉ guru@xxxxxxxxxxx, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub
May, 9: Спаси́бо освободители! Thank you very much, Russian liberators!





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux