admin管理员组

文章数量:1336401

Edited: I was trying to create a table within PostgreSql server but got an error.

ERROR:  syntax error at or near "\"
LINE 40: \COPY public.fy24pcard 
         ^ 

SQL state: 42601
Character: 812

and the query looks like this:

\COPY public.fy24pcard 
FROM 'C:\Users\Omitted.csv' 
WITH DELIMITER ',' CSV HEADER

Can someone help me with this?

I tried importing the file using IMPORT but failed.

Edited: I was trying to create a table within PostgreSql server but got an error.

ERROR:  syntax error at or near "\"
LINE 40: \COPY public.fy24pcard 
         ^ 

SQL state: 42601
Character: 812

and the query looks like this:

\COPY public.fy24pcard 
FROM 'C:\Users\Omitted.csv' 
WITH DELIMITER ',' CSV HEADER

Can someone help me with this?

I tried importing the file using IMPORT but failed.

Share edited Nov 19, 2024 at 20:38 fishli asked Nov 19, 2024 at 18:53 fishlifishli 111 silver badge3 bronze badges 2
  • As answer from @FrankHeikens say \copy is a psql command. So either use psql or the pgAdmin4 GUI for COPY as shown here Import/Export data. – Adrian Klaver Commented Nov 19, 2024 at 19:09
  • You really expect to get an answer without providing any useful information? To the question text add as text the following: 1) Definition of what you mean by IMPORT. 2) What failed and what where the error messages? – Adrian Klaver Commented Nov 19, 2024 at 21:36
Add a comment  | 

1 Answer 1

Reset to default 1

\COPY is a command for the psql client, not for pgadmin. Remove the \

本文标签: pgadmin 4SQL state 42601 Error in PostgreSQL when creating a tableStack Overflow