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

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Matthias Apitz <guru(at)unixarea(dot)de>, Postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Two small questions re/ COPY CSV data into table
Date: 2019-06-04 16:26:50
Message-ID: 20190604162650.GA15928@sh4-5.1blu.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

El día Tuesday, June 04, 2019 a las 04:41:47PM +0100, Andrew Gierth escribió:

> Matthias> I do load this now with COPY in mode TEXT and modify the data
> Matthias> before with:
>
> Matthias> sed 's/|/\v/g' < table-from-Sybase | sed 's/\\\v/|/g' > table-for-copy
>
> What on earth is this supposed to achieve?

It first translates any char '|' to vtab and then any '\vtab' (i.e. a
backslash followed by a vtab) back to the char |

The new DELIMITER for PG is then vtab and the | is just a char in the
data (in the example above a pipe of two UNIX cmd). Do you do UNIX?

matthias

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Frank Alberto Rodriguez 2019-06-04 16:29:16 Re: One way replication in PostgreSQL
Previous Message Laurenz Albe 2019-06-04 16:24:09 Re: Long running query - connection and keepalives enabled but query not canceled