“插入”处或附近的 postgreSQL 语法错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36875900/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 02:15:22 来源:igfitidea点击:
postgreSQL syntax error at or near "INSERT"
提问by aster
Here is my code:
这是我的代码:
SET SEARCH_PATH TO work
/* Task 1 */
INSERT INTO Category (CategoryID, Name, CategoryType)
VALUES(1,'English','fiction');
and here is the error:
这是错误:
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
回答by Ray O'Donnell
You need a semi-colon at the end of the SET statement:
在 SET 语句的末尾需要一个分号:
SET SEARCH_PATH TO work;
回答by Berra2k
Try to just do an insert into that is schema qualified:
尝试只插入一个符合模式的插入:
INSERT INTO work.Category (CategoryID, Name, CategoryType)
VALUES(1,'English','fiction');
Or
或者
SET SEARCH_PATH TO work;
/* Task 1 */
INSERT INTO Category (CategoryID, Name, CategoryType)
VALUES(1,'English','fiction');
Either should fix the error.
要么应该修复错误。