“INSERT”或其附近的postgreSQL语法错误

时间:2016-04-26 21:14:49

标签: sql postgresql

这是我的代码:

SET SEARCH_PATH TO work

/* Task 1 */

INSERT INTO Category (CategoryID, Name, CategoryType)    

VALUES(1,'English','fiction');

这是错误:

ERROR:  syntax error at or near "INSERT"
LINE 4: INSERT INTO Category (CategoryID,Name,CategoryType)
          ^
********** Error **********

ERROR: syntax error at or near "INSERT"
SQL state: 42601
Character: 45

2 个答案:

答案 0 :(得分:2)

在SET语句的末尾需要一个分号:

SET SEARCH_PATH TO work;

答案 1 :(得分:1)

尝试插入符合模式的插件:

INSERT INTO work.Category (CategoryID, Name, CategoryType)    

VALUES(1,'English','fiction');

或者

SET SEARCH_PATH TO work;

/* Task 1 */

INSERT INTO Category (CategoryID, Name, CategoryType)    

VALUES(1,'English','fiction');

要么修复错误。