查询该表报错: test=# select count(*) from test; 2021-04-28 11:41:35.783 HKT [36138] ERROR: catalog is missing 10 attribute(s) for relid 30804 at character 22 2021-04-28 11:41:35.783 HKT [36138] STATEMENT: select count(*) from test; ERROR: XX000: catalog is missing 10 attribute(s) for relid 30804 LINE 1: select count(*) from test; ^ LOCATION: RelationBuildTupleDesc, relcache.c:581 Time: 0.707 ms 一般报这种错就是表有损坏,可以尝试从备份中恢复,或者直接删除,但 删除该表发现报错: test=# drop table if exists test; 2021-04-28 11:39:50.670 HKT [36138] ERROR: cache lookup failed for attribute 9 of relation 30804 2021-04-28 11:39:50.670 HKT [36138] STATEMENT: drop table if exists test; ERROR: XX000: cache lookup failed for attribute 9 of relation 30804 LOCATION: get_relid_attribute_name, lsyscache.c:808 Time: 0.870 ms 问题解决思路: 找到test表对应的oid值,然后根据oid值在pg_class和pg_depend表里删除对应的元数据信息。查test表的oid值: test=# select oid from pg_class where relname='test'; oid ------- 30804 (1 row) Time: 0.649 ms 删除pg_class中对应test的元数据信息: 11:41:42 (postgres@127.0.0.1:5432)test=# delete from pg_class where oid =30804; DELETE 1 Time: 1.189 ms 删除pg_class中对应test的元数据信息: 11:41:55 (postgres@127.0.0.1:5432)test=# delete from pg_depend where objid = 30804; DELETE 1 test表已正常从数据库里删除: test=# select count(*) from test; 2021-04-28 11:52:06.483 HKT [36138] ERROR: relation "test" does not exist at character 22 2021-04-28 11:52:06.483 HKT [36138] STATEMENT: select count(*) from test; ERROR: 42P01: relation "test" does not exist LINE 1: select count(*) from test; ^ LOCATION: parserOpenTable, parse_relation.c:1180 Time: 0.547 ms 备注: pg_class元数据表记录表和几乎所有具有列或者像表的东西。这包括索引(但还要参见pg_index)、序列(但还要参见pg_sequence)、视图、物化视图、组合类型和TOAST表。 pg_depend 目录pg_depend元数据表记录数据库对象之间的依赖关系。这些信息允许DROP命令查找必须被DROP CASCADE删除的其他对象, 或者在DROP RESTRICT情况下阻止删除。
catalog is missing 10 attribute(s)错误的解决办法一例
来源:这里教程网
时间:2026-03-14 20:17:08
作者:
编辑推荐:
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- PostgreSQL中的触发器
PostgreSQL中的触发器
26-03-14 - 流复制浅析 —— 主备切换
流复制浅析 —— 主备切换
26-03-14 - 如何将excel表格数据导入postgresql数据库
如何将excel表格数据导入postgresql数据库
26-03-14 - 【读书笔记】《PostgreSQL指南-内幕探索》-8.缓冲区管理器
【读书笔记】《PostgreSQL指南-内幕探索》-8.缓冲区管理器
26-03-14 - 2. PostgreSQL 流复制
2. PostgreSQL 流复制
26-03-14 - LSN与段文件的关系
LSN与段文件的关系
26-03-14 - 事务回卷浅析
事务回卷浅析
26-03-14 - 使用PG_STAT_REPLICATION监视复制
使用PG_STAT_REPLICATION监视复制
26-03-14 - Pgbouncer最佳实践:系列三
Pgbouncer最佳实践:系列三
26-03-14 - 【读书笔记】《PostgreSQL指南-内幕探索》-7.堆内元组和仅索引扫描
