test=# SELECT * FROM pg_catalog.pg_backup_history; ERROR: relation "pg_catalog.pg_backup_history" does not exist LINE 1: SELECT * FROM pg_catalog.pg_backup_history;
时间: 2024-02-20 16:02:14 浏览: 159
如果您执行 `SELECT * FROM pg_catalog.pg_backup_history;` 命令时遇到 "relation does not exist" 的错误,可能是因为 Kingbase 数据库并没有这个表。
在 Kingbase 中,备份历史记录是存储在 `pg_stat_backup` 系统视图中的。您可以使用以下命令来查看备份历史记录:
```
SELECT * FROM pg_catalog.pg_stat_backup;
```
这将显示所有备份的详细信息,包括备份ID、备份开始和结束时间、备份方式等等。如果您需要更详细的备份信息,可以查看Kingbase的官方文档或者联系 Kingbase 的技术支持人员获取帮助。
相关问题
pg_dumpall: query failed: ERROR: permission denied for relation pg_authid
As an AI language model, I don't have the necessary context to provide a specific solution to this error message. However, in general, this error message indicates that the user running the pg_dumpall command does not have sufficient permissions to access the pg_authid relation.
To resolve this error, you may need to grant the appropriate permissions to the user. This can typically be done using the GRANT command in PostgreSQL.
Alternatively, you may need to run the pg_dumpall command as a superuser or a user with sufficient permissions to access all database objects.
It's also possible that there is a configuration issue or a bug in PostgreSQL that is causing this error. In that case, you may need to consult the PostgreSQL documentation or seek assistance from the PostgreSQL community.
pgsql function pg_total_relation_size(name) does not exist
抱歉,我之前给出的解决方法中使用的函数 `pg_total_relation_size` 是错误的。正确的函数应该是 `pg_size_pretty`。以下是正确的查询语句来获取磁盘总容量和使用情况:
```sql
SELECT
pg_size_pretty(pg_total_relation_size(pg_stat_all_tables)) AS total_size,
pg_size_pretty(pg_database_size(current_database())) AS database_size;
```
这个查询语句将返回两个结果:
- `total_size`:表示数据库所在磁盘的总容量。
- `database_size`:表示当前数据库的占用空间大小。
请注意,这个查询只会返回当前连接的数据库的信息。如果你想查看其他数据库的磁盘使用情况,可以在查询语句中指定相应的数据库名称。
阅读全文