我不断收到错误“关系[TABLE]不存在", [英] I keep getting the error "relation [TABLE] does not exist"

查看:105
本文介绍了我不断收到错误“关系[TABLE]不存在",的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试查询数据库中的两个表.在服务器资源管理器中,我可以看到两个表,甚至可以看到其中的列.我们将它们称为Schema.table1和Schema.table2,其中"Schema"的首字母大写.我尝试运行以下查询:

I have been trying to query two tables in my database. In the server explorer I can see both tables and even see the columns within them. We'll call them Schema.table1 and Schema.table2 where "Schema" has its first letter capitalized. I have tried running the following queries:

select * from Schema.table1;

哪里出现以下错误:

错误:关系"schema.table1"不存在

ERROR: relation "schema.table1" does not exist

然后我尝试运行下一个查询,以为架构中的大写字母可能有所不同.

I then tried running the next query thinking maybe the capitalization in the schema made a difference.

Select * from "Schema.table1"; 
select "ID" from "Schema.table1";

但相同的错误仍然存​​在:

But the same error persisted:

错误:关系"Schema.table1"不存在

ERROR: relation "Schema.table1" does not exist

我后来尝试使用"SET search_path to"Schema1"指定架构路径,并在表上运行查询,这再次为我提供了相同的错误.任何想法或帮助将不胜感激.

I later tried to specify the schema path with "SET search_path to "Schema1" and ran a query on the tables which again provided me the same error. Any ideas or help would be greatly appreciated.

推荐答案

每个元素都必须单独引用:

Each element has to be quoted individually:

select "ID" 
from "Schema"."table1";

有关带引号的标识符的更多详细信息,请参见在手册中

More details about quoted identifiers are in the manual

这篇关于我不断收到错误“关系[TABLE]不存在",的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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