Re: csv copy error

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: ourdiaspora <ourdiaspora(at)protonmail(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: csv copy error
Date: 2021-12-29 21:46:44
Message-ID: CAKFQuwbjyV+HKo78GifqZkzJ6zH8vD_Bx2Zz3fVnfghk_-sNyw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday, December 29, 2021, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:

> On 12/29/21 13:08, ourdiaspora wrote:
>
>>
>> "
>> \copy exampletable from '/local/path/to/examplefile.csv';
>> "
>>
>
> \copy exampletable from '/local/path/to/examplefile.csv with csv';
>
>
Right idea though that won’t execute for three reasons (bad quoting,
missing parentheses, missing field type for the value csv). The main issue
is the OP is accepting all defaults but the file format is not in the
default format. Either the format needs to be changed or the OP needs to
specify a combination of options that describes the file format.
Specifying the csv format I think is a valid solution though there are
others. The documentation describes the options, syntax, and effects
sufficiently so I will not belabor the details.

David J.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Lewis 2021-12-29 22:59:10 Default values in functions
Previous Message Adrian Klaver 2021-12-29 21:15:54 Re: csv copy error