DBAtlas · 数据库运维图谱

42P01: undefined_table

PostgreSQL

含义

查询中引用的表(或视图)不存在,或在 search_path 中找不到。

原因

表确实不存在、表位于不在 search_path 中的其他 schema、表名拼写/大小写错误、与带引号标识符的大小写不匹配,或对象尚未创建或已被删除。

解决方法

确认表存在及其所属 schema:SELECT schemaname, tablename FROM pg_tables WHERE tablename = 'my_table'。如果位于其他 schema,用 schema.table 限定,或设置 search_path:SET search_path TO app_schema, public。注意不带引号的标识符会被转换为小写;如果创建时使用了引号,引用时也要以相同方式书写。

在 DBAtlas 中打开 →

同一数据库的其他条目