Re: import CSV file to a table

From: Rob Sargent <robjsargent(at)gmail(dot)com>
To: Karl Czajkowski <karlcz(at)isi(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: import CSV file to a table
Date: 2017-03-08 16:45:09
Message-ID: 7cce119b-b21c-bfed-ffa4-983f8c5803a7@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 03/08/2017 09:36 AM, Karl Czajkowski wrote:
> I believe that in its fully glory, you cannot reliably locate CSV
> record boundaries except by parsing each field in order including
> quote processing. Individual records may have arbitrary numbers of
> field and record separator characters within the values.
>
> Karl
>
>
> On Mar 08, Rob Sargent modulated:
>> Since bash has been bandied about in this thread I presume awk is
>> available. Here's how I would check just how 'csv'ish the incoming
>> file is.
>> ...
Yes Karl, I agree. I admitted as much. But if it's clean, as in free
of quoted commas, life is much more simple. I've lost site of whether
or not the OP knows his situation w.r.t. to this. The awk line will
tell him and for a one-off load this can make a world of difference in
complexity - two bash lines and a COPY.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2017-03-08 16:47:17 Re: Unable to start postgresql
Previous Message Adrian Klaver 2017-03-08 16:37:27 Re: Unable to start postgresql