pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter_e@gmx.net>
To: Kenneth Evans <unicorn@unicorn.homechoice.co.uk>
Cc: pgsql-sql@postgresql.org
Subject: Re: copy from command - quotes and header lines
Date: Wed, 27 Nov 2002 00:52:26 +0100 (CET)
Message-ID: <Pine.LNX.4.44.0211262004010.12428-100000@localhost.localdomain> (raw)
In-Reply-To: <000a01c293dd$eb9bb1a0$ab91200a@computer>

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@gmx.net




view thread (2+ messages)

Message-ID: <Pine.LNX.4.44.0211262004010.12428-100000@localhost.localdomain>
Permalink:  ../Pine.LNX.4.44.0211262004010.12428-100000@localhost.localdomain/
Also on:    postgresql.org/message-id/Pine.LNX.4.44.0211262004010.12428-100000@localhost.localdomain

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: peter_e@gmx.net, unicorn@unicorn.homechoice.co.uk
  Subject: Re: copy from command - quotes and header lines
  In-Reply-To: <Pine.LNX.4.44.0211262004010.12428-100000@localhost.localdomain>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox