Re: csv copy error - Mailing list pgsql-general

From David G. Johnston
Subject Re: csv copy error
Date
Msg-id CAKFQuwbjyV+HKo78GifqZkzJ6zH8vD_Bx2Zz3fVnfghk_-sNyw@mail.gmail.com
Whole thread Raw
In response to Re: csv copy error  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Wednesday, December 29, 2021, Adrian Klaver <adrian.klaver@aklaver.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.
 

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: csv copy error
Next
From: Michael Lewis
Date:
Subject: Default values in functions