错误“值"不存在 - postgresql INSERT INTO 问题 [英] Error "value" does not exist - postgresql INSERT INTO issue

查看:32
本文介绍了错误“值"不存在 - postgresql INSERT INTO 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个新表,但我很难插入任何数据

I've created a new table but I'm struggling to insert any data

表格如下所示,其中 id 列是自增整数,name 是字符串列

The table looks like the below where the id column is an auto incrementing integer and name is a string column

select * from transaction_categories;
category_id | name 
------------+------
(0 rows)

这是我要运行的查询:

INSERT INTO transaction_categories (category_id, name)
VALUES (1,’General’);

但我收到此错误:

ERROR:  column "’general’" does not exist
LINE 2: VALUES (1,’General’);

到目前为止,我在 SO 上发现的所有内容都指向使用单引号而不是双引号,我就是这样.我已经从 postgres 文档中获取了基本的插入语句,并复制并粘贴了相关的表/列名,但我仍然遇到这个问题

Everything I've found so far on SO has pointed to using single quotes instead of double quotes, which I am. I have literally taken the basic insert statement from postgres documentation and copied and pasted the relevant table / column names, but I'm still running into this issue

我错过了什么?!

推荐答案

请试试这个,传统的引号,我们不需要在这里告诉插入查询的列名:

Please try this, traditional quotes and we do not need here to tell column names for insert query:

INSERT INTO transaction_categories 
VALUES (1,'General');

这篇关于错误“值"不存在 - postgresql INSERT INTO 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆