El día Tuesday, June 04, 2019 a las 07:20:54PM +0200, Matthias Apitz escribió:
> El día Tuesday, June 04, 2019 a las 05:56:49PM +0100, Andrew Gierth escribió:
>
> > If you use COPY ... WITH DELIMITER '|' (i.e. text mode, not CSV mode)
> > then the \| is accepted as being a literal | and the unesc
Mathias:
On Tue, Jun 4, 2019 at 8:35 PM Matthias Apitz wrote:
> El día Tuesday, June 04, 2019 a las 05:41:43PM +0200, Francisco Olarte
> escribió:
> > On Tue, Jun 4, 2019 at 5:03 PM Matthias Apitz wrote:
> > > Well, it's not strictly CSV, but it is what the Sybase tool produces. The
> > > deli
> "Matthias" == Matthias Apitz writes:
Matthias> it is exported into the file as
Matthias> cmd \| lpr ...
Matthias> because the export delimiter is set to '|';
Matthias> the COPY in text mode was complaining because it interpreted
Matthias> the | of the sequence \| as an delimite
El día Tuesday, June 04, 2019 a las 05:56:49PM +0100, Andrew Gierth escribió:
> Matthias> The new DELIMITER for PG is then vtab and the | is just a char in
> the
> Matthias> data (in the example above a pipe of two UNIX cmd).
>
> Yes, but why?
>
> If you use COPY ... WITH DELIMITER '|' (i.e.
> "Matthias" == Matthias Apitz writes:
Matthias> sed 's/|/\v/g' < table-from-Sybase | sed 's/\\\v/|/g' >
table-for-copy
>> What on earth is this supposed to achieve?
Matthias> It first translates any char '|' to vtab and then any '\vtab'
Matthias> (i.e. a backslash followed by a vtab
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
> "Matthias" == Matthias Apitz writes:
>> That sounds like the file is not actually a CSV - why do you think
>> it is?
Matthias> Well, it's not strictly CSV,
In other words it's not a CSV at all.
Matthias> I do load this now with COPY in mode TEXT and modify the data
Matthias> before
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
> Matthi
> "Matthias" == Matthias Apitz writes:
Matthias>... WITH DELIMITER '|', FORMAT CSV ;
I think you misread the docs; the new-style syntax would be
COPY ... WITH (DELIMITER '|', FORMAT CSV);
where the parens are not optional. The old-style syntax with no parens
after WITH is what you wer
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 DELI
10 matches
Mail list logo