Postgres:当 table 存在于 public 模式时,关系不存在错误

Postgres: relation does not exist error when table exists on public schema

我有一个 table 使用 Pandas 转储到 Postgres 并且 Pandas 可以使用 read_sql_table 命令读取它,但我似乎无法能够使用 SQL 访问它。当我 运行 \dt 命令时,我得到 public 模式下列出的 table 作为现有 table 之一。

                 List of relations
 Schema |                Name                | Type  |  Owner   
--------+------------------------------------+-------+----------
 public | "e7b6a2e19789418e9e48fd34e981b036" | table | postgres

但是当我 运行 SELECT * FROM "e7b6a2e19789418e9e48fd34e981b036"; 我得到关系不存在的错误。我尝试了以下方法:

当我 运行 SHOW search_path; 它显示 "$user", public 它应该是什么但出于某种原因 Postgres 一直说关系不存在。

其他有用信息:

是否知道可能导致此错误的原因?

您的 table 名称包含双引号。

在标识符中嵌入双引号遵循与在字符串文字中嵌入单引号相同的规则:您需要将它们加倍:

所以 table 是用这样的东西创建的:

create table """e7b6a2e19789418e9e48fd34e981b036"""(...);

当您 select 来自它时,您需要使用相同的语法:

SELECT * 
FROM """e7b6a2e19789418e9e48fd34e981b036""";