Two small questions re/ COPY CSV data into table

From: Matthias Apitz <guru(at)unixarea(dot)de>
To: Postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Two small questions re/ COPY CSV data into table
Date: 2019-06-04 10:02:47
Message-ID: 20190604100247.GA2800@c720-r342378
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hello,

I'm using COPY to load CSV data into the table in PG 10.x and have to simple
questions:

1. I do use as command:

COPY adm_cat FROM '/home/sisis/PostgreSQL/PDcsv/adm_cat.load' WITH DELIMITER '|' CSV ;

which works fine. When I read the PG docs the syntax should be

... WITH DELIMITER '|', FORMAT CSV ;

But this gives an syntax error as:

LINE 1: .../PostgreSQL/PDcsv/adm_cat.load' WITH DELIMITER '|', FORMAT C...

and the ',' is marked as its place. Why?

2. The CSV export is done by some Sybase tool which escapes the
delimiter as '\|', i.e. putting a backslash before the delimiter. I
found no way that COPY understands this excaping. Any ideas?

Thanks

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!

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gierth 2019-06-04 10:32:45 Re: Two small questions re/ COPY CSV data into table
Previous Message Matteo Beccati 2019-06-04 09:00:39 Research on ?? operators