Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
错误:关系的列不存在PostgreSQL,无法运行插入查询_Sql_Postgresql_Sql Insert_Quoted Identifier - Fatal编程技术网

错误:关系的列不存在PostgreSQL,无法运行插入查询

错误:关系的列不存在PostgreSQL,无法运行插入查询,sql,postgresql,sql-insert,quoted-identifier,Sql,Postgresql,Sql Insert,Quoted Identifier,嗨,我正试图插入到一个表tester3中,当我使用语法时,它失败了 insert into tester3 (UN0, UN1) values ( 1, 'jishnu1'); 但是 工作正常 mydb=# CREATE TABLE tester3 mydb-# ( mydb(# "UN0" integer, mydb(# "UN1" VARCHAR(40) mydb(# ); CREATE TABLE mydb=# insert into tester3 (UN0

嗨,我正试图插入到一个表tester3中,当我使用语法时,它失败了

insert into tester3 (UN0, UN1) values ( 1, 'jishnu1');
但是

工作正常

mydb=# CREATE TABLE tester3
mydb-#    (
mydb(#     "UN0" integer,
mydb(#     "UN1" VARCHAR(40)
mydb(#    );
CREATE TABLE
mydb=# insert into tester3 (UN0, UN1) values ( 1, 'jishnu1');
ERROR:  column "un0" of relation "tester3" does not exist
mydb=# \d tester3
           Table "public.tester3"
 Column |         Type          | Modifiers
--------+-----------------------+-----------
 UN0    | integer               |
 UN1    | character varying(40) |
我想我遗漏了一些非常琐碎的东西,我尝试了一些其他的列名,其中一些很好,一些不起作用。我很困惑。PostgreSQL是否对insert查询的第一种语法适用的列名有限制


编辑:

签出Girdon Linoff答案,并指出其他列名在小写中没有引号

小写列是PostgreSQL中的标准列,也可以不使用引号


如果使用双引号定义列,则在引用列时通常需要使用双引号:

insert into tester3 ("UN0", "UN1")
     values ( 1, 'jishnu1');
我建议您删除
CREATE TABLE
语句中列名的双引号


如果名称都是小写,则不需要双引号。

尝试在列名中使用双引号

insert into tester3 ("UN0", "UN1") values ( 1, 'jishnu1');

奇怪的是,表的描述没有显示双引号。但是,是的,这似乎是正确的答案。现在我完全困惑了,我创建了“column0”整数,“column1”VARCHAR(40)它不工作quotes@JishnuPrathap:这都是小写,这是PostgreSQL中的标准,也可以不带引号使用。@jishnupathap您将这些列显式地创建为大写,但后来以不区分大小写的方式查询它们,所以找不到它们。当您将名称置于引号中时,查找将区分大小写。@Unglückspilz您应该将其作为答案,因为这是通用问题核心:)您可以在此处找到有关标识符名称的详细信息:
insert into tester3 ("UN0", "UN1") values ( 1, 'jishnu1');