我在Mac OS X 10.7.2上运行PostgreSQL服务器。有时是随机查询,尤其是
CREATE OR REPLACE TEMPORARY VIEW <Name> AS SELECT * FROM <Table>;
代码PGRES_FATAL_ERROR = 7
和消息
ERROR: invalid page header in block 4169 of relation "pg_type"
2-5次尝试后,查询结束,没有错误。
我认为由系统驱动器上的可用空间不足引起的问题是因为应用程序正常运行而没有数据库错误,而系统驱动器上有大量可用空间。
如何指定错误导致查询失败?
更新:添加了日志
sh-3.2# cat postgres_LOG.1324986905
LOG: database system was shut down at 2011-12-27 15:54:32 MSK
LOG: checkpoint record is at 1/EEE1161C
LOG: redo record is at 1/EEE1161C; undo record is at 0/0; shutdown TRUE
LOG: next transaction ID: 1814900; next OID: 808694
LOG: next MultiXactId: 1; next MultiXactOffset: 0
LOG: database system is ready
LOG: transaction ID wrap limit is 1073763426, limited by database "my_db"
LOG: connection received: host=::1 port=49159
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49161
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49162
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49263
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49264
LOG: connection authorized: user=my_db database=my_db
ERROR: invalid page header in block 4169 of relation "pg_type"
LOG: connection received: host=::1 port=49266
LOG: connection authorized: user=my_db database=my_db
ERROR: invalid page header in block 4169 of relation "pg_type"
LOG: connection received: host=::1 port=49273
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49274
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49276
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49277
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49362
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=49363
LOG: connection authorized: user=my_db database=my_db
LOG: connection received: host=::1 port=50293
LOG: connection authorized: user=my_db database=my_db
sh-3.2#
答案 0 :(得分:1)
听起来非常像磁盘/文件系统损坏。我建议您尽快在数据库上执行转储/重新加载循环 - 如果可能的话还要检查文件系统和磁盘硬件。
不应与可用磁盘空间相关 - 这会给您带来不同的错误。
答案 1 :(得分:0)
更有可能某些系统表已损坏。至少pg_type
。由于pg_type
通常非常小(十几页/块),但您的数字(4169)非常大,可能还有其他问题潜伏在吸尘之中。