Re: copy from command - quotes and header lines

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Kenneth Evans <unicorn(at)unicorn(dot)homechoice(dot)co(dot)uk>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: copy from command - quotes and header lines
Date: 2002-11-26 23:52:26
Message-ID: Pine.LNX.4.44.0211262004010.12428-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Kenneth Evans writes:

> On the other hand the COPY FROM file command has it the other way round - if the separators are semi-colons then the source file
> London;12;15.7
> Paris;13;22.2
> will work
>
> but
> 'London'; '12'; '15.7'
> 'Paris';'13';'22.2'
> will not!

The COPY input data is a separate data format, so you canno expect quoting
and other features of SQL to work. Read the documentation if you're
curious about details.

> b) My source files for populating the database tables have three header
> lines. It would be convenient if the COPY FROM command had another
> parameter eg "HEADERS n" meaning skip first n lines of input file.

> My current workaround uses a perl pipe but I would prefer a cleaner
> solution.

What's unclean about that?

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2002-11-27 02:14:54 Re: [SQL] [SQL/BUGS] (possible) inconsistent behaviour of timestamp?
Previous Message Thomas Good 2002-11-26 19:19:40 Casting Money To Numeric