插入命令 :: 错误:列“值"不存在 [英] INSERT COMMAND :: ERROR: column "value" does not exist
问题描述
我正在使用 postgresql 并且我正在尝试将数据插入表 users
.当我使用
INSERT INTO users(user_name, name, password,email) VALUES ("user2","first last","password1", "user2@gmail.com" );
我收到以下错误:
错误:user2"列不存在
这是桌子的样子.
表public.users"专栏 |类型 |修饰符用户名 |字符变化(50) |姓名 |字符变化(50) |密码 |字符变化(50) |电子邮件 |字符变化(100) |用户 ID |整数 |not null default nextval('users_user_id_seq'::regclass)索引:"users_pkey" PRIMARY KEY, btree (user_id)
我可以插入一行,但现在不起作用.
字符常量需要单引号.
使用:INSERT INTO users(user_name, name, password,email) VALUES ('user2','first last','password1', 'user2@gmail.com');
>
参见手册:postgresql.org/docs/current/static/...
注意:在我遇到同样的问题并且几乎错过了这个页面中存在的答案(在评论部分)之后,感谢@a-horse-with-no-name - 我已经发布了这个答案
I am using postgresql and I am trying to insert data into a table users
. When I do that using
INSERT INTO users(user_name, name, password,email) VALUES ("user2","first last","password1", "user2@gmail.com" );
I get the following error:
ERROR: column "user2" does not exist
This is how the table looks like.
Table "public.users"
Column | Type | Modifiers
user_name | character varying(50) |
name | character varying(50) |
password | character varying(50) |
email | character varying(100) |
user_id | integer | not null default nextval('users_user_id_seq'::regclass)
Indexes:
"users_pkey" PRIMARY KEY, btree (user_id)
I was able to insert a row, but it is not working now.
Character constants need single quotes.
Use: INSERT INTO users(user_name, name, password,email) VALUES ('user2','first last','password1', 'user2@gmail.com' );
See the manual: postgresql.org/docs/current/static/…
Note: After I encountered the same problem and almost missed the answer that exists in this page (at the comments section), thanks to @a-horse-with-no-name - I've posted this answer
这篇关于插入命令 :: 错误:列“值"不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!