【发布时间】:2012-09-07 20:28:57
【问题描述】:
我正在尝试对 postgres 表执行简单的插入操作,但出现错误提示我尝试插入的值被解释为列名
INSERT INTO "imageTagBusinessMainCategory"
(id, businessMainCategory)
VALUES
(DEFAULT, "auto dealer")
其中 id 设置为主键,自动递增,不为空。这些是我在 phpPgAdmin 中设置表格时勾选的框。
我收到了这个错误:
ERROR: ERROR: column "auto dealer" does not exist
Query = INSERT
INTO "imageTagBusinessMainCategory"
(id, businessMainCategory)
VALUES
(DEFAULT,
"auto dealer")
我已经将我的表名放在双引号中,因为我应该阅读 here。
并使用DEFAULT 自动增加ID,因为我应该阅读here。
有什么想法吗? 谢谢!
【问题讨论】:
-
对“汽车经销商”使用单引号。
-
单引号。去掉id。
-
@muratgu 给出错误:
ERROR: ERROR: syntax error at or near "'imageTagBusinessMainCategory'" Position: 13 -
@PaulTomblin 你是什么意思“离开身份证”?谢谢!
-
我的意思是它在@Randy 的回答中显示。除了看起来您还需要在列名周围加上双引号。
标签: sql postgresql string-constant