我使用了命令:
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 ';'
我收到以下错误:
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
我想知道我的代码中的错误
答案 0 :(得分:1)
Linux上的有效COPY
syntax for version 9.1应为:
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
,而不是
USING
DELIMITER
代替 。DELIMITERS
不要使用primary
作为列名。 It's a reserved word.