Question

I used the command:

COPY studentapp_deg_course_cat(degree_code, specialization, category_level1, category_level2, category_level3, min_credit, max_credit, primary)
FROM '/home/abhishek/Downloads/courses.csv'
USING DELIMITERS ';'

and i am getting the following error:

ERROR:  syntax error at or near "COPY" LINE 1: COPY studentapp_deg_course_cat(degree_code, specialization,...
        ^

********** Error **********

ERROR: syntax error at or near "COPY" SQL state: 42601 Character: 1

I would like to know the error in my code

Was it helpful?

Solution

Valid COPY syntax for version 9.1 on Linux should be:

COPY studentapp_deg_course_cat(degree_code, specialization, category_level1,
            category_level2, category_level3, min_credit, max_credit, "primary")
FROM '/home/abhishek/Downloads/courses.csv'
WITH (DELIMITER ';')

WITH, not USING.
DELIMITER instead of DELIMITERS.

And do not use primary as column name. It's a reserved word.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top