Re: Copying entire tsv record (from file) into a single field - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: Copying entire tsv record (from file) into a single field
Date
Msg-id 4CFE1705.5070508@iol.ie
Whole thread Raw
In response to Copying entire tsv record (from file) into a single field  (Allan Kamau <kamauallan@gmail.com>)
Responses Re: Copying entire tsv record (from file) into a single field  (Allan Kamau <kamauallan@gmail.com>)
List pgsql-general
On 07/12/2010 11:07, Allan Kamau wrote:
> I would like to use copy to populate a single row in table with data
> from a tsv file for further transformations.
> I seem not find a way to stop copy from seeing that the tsv file does
> indeed contain fields.
> This my current query
>
>         COPY raw_data
>         (
>         raw_record
>         )
>         FROM
>         '/tmp/some.tsv'
>         ;

You can specify the character which COPY sees as the field delimiter to
be something other than a tab - maybe a comma, if there are no commas in
your input:

   copy raw_data(raw_record)
   from '/tmp/some.tsv'
   with delimiter ',';

Would that do the job?

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

pgsql-general by date:

Previous
From: Allan Kamau
Date:
Subject: Copying entire tsv record (from file) into a single field
Next
From: Vincent Veyron
Date:
Subject: Re: Implement online database using Postgresql