Re: csv copy error - Mailing list pgsql-general

From Guillaume Lelarge
Subject Re: csv copy error
Date
Msg-id CAECtzeV3gs_Ga+XmRrPHCE98WQdYs51UUf2W5LEW17p5VDLNQg@mail.gmail.com
Whole thread Raw
In response to csv copy error  (ourdiaspora <ourdiaspora@protonmail.com>)
Responses Re: csv copy error  (ourdiaspora <ourdiaspora@protonmail.com>)
List pgsql-general
Hi,

Le mer. 29 déc. 2021 à 22:08, ourdiaspora <ourdiaspora@protonmail.com> a écrit :
Readers,

Please could anyone help with the following error produced:

"
ERROR:  invalid input syntax for integer: "1,m "
CONTEXT:  COPY exampletable, line 1, column examplenumber: "1,m "

The database commands:

"
CREATE TABLE exampletable (examplenumber smallint,
exampletitle varchar(500)
);
"

"
 \copy exampletable from '/local/path/to/examplefile.csv';
"

CSV file contents:

"
1,m
2,m
9,t
"


You should tell the CSV command you're using a CSV file. By default, COPY thinks it's a TSV file.


--
Guillaume.

pgsql-general by date:

Previous
From: Hasan Marzooq
Date:
Subject: pg_config header files are missing - Postgres 13 - Amazon Linux 2
Next
From: Magnus Hagander
Date:
Subject: Re: pg_config header files are missing - Postgres 13 - Amazon Linux 2