mirror of
https://github.com/postgrespro/pg_probackup.git
synced 2024-12-11 11:41:33 +02:00
checkdb: fix index query and logging error condition
This commit is contained in:
parent
d5b0747288
commit
56a909da0c
16
src/backup.c
16
src/backup.c
@ -3554,8 +3554,8 @@ get_index_list(PGresult *res_db, int db_number,
|
||||
|
||||
res = pgut_execute(db_conn, "SELECT cls.oid, cls.relname "
|
||||
"FROM pg_index idx "
|
||||
"JOIN pg_class cls ON cls.oid=idx.indexrelid "
|
||||
"JOIN pg_am am ON am.oid=cls.relam "
|
||||
"JOIN pg_class cls ON idx.indexrelid=cls.oid "
|
||||
"JOIN pg_am am ON cls.relam=am.oid "
|
||||
"WHERE am.amname='btree' AND cls.relpersistence != 't'",
|
||||
0, NULL);
|
||||
}
|
||||
@ -3564,11 +3564,13 @@ get_index_list(PGresult *res_db, int db_number,
|
||||
|
||||
res = pgut_execute(db_conn, "SELECT cls.oid, cls.relname "
|
||||
"FROM pg_index idx "
|
||||
"JOIN pg_class cls ON cls.oid=idx.indexrelid "
|
||||
"JOIN pg_am am ON am.oid=cls.relam "
|
||||
"JOIN pg_tablespace tbl ON tbl.oid=cls.reltablespace "
|
||||
"WHERE am.amname='btree' AND cls.relpersistence != 't' "
|
||||
"AND tbl.spcname != 'pg_global'",0, NULL);
|
||||
"JOIN pg_class cls ON idx.indexrelid=cls.oid "
|
||||
"JOIN pg_am am ON cls.relam=am.oid "
|
||||
"LEFT JOIN pg_tablespace tbl "
|
||||
"ON cls.reltablespace=tbl.oid "
|
||||
"AND tbl.spcname <> 'pg_global' "
|
||||
"WHERE am.amname='btree' AND cls.relpersistence != 't'",
|
||||
0, NULL);
|
||||
}
|
||||
|
||||
/* add info needed to check indexes into index_list */
|
||||
|
@ -480,9 +480,14 @@ main(int argc, char *argv[])
|
||||
instance_config.pgdata == NULL)
|
||||
elog(ERROR, "required parameter not specified: --instance");
|
||||
|
||||
if (backup_subcmd == CHECKDB_CMD
|
||||
&& (instance_config.logger.log_level_file != LOG_OFF)
|
||||
&& (instance_config.logger.log_directory == NULL))
|
||||
/* Usually checkdb for file logging requires log_directory
|
||||
* to be specified explicitly, but if backup_dir and instance name are provided,
|
||||
* checkdb can use the tusual default values or values from config
|
||||
*/
|
||||
if (backup_subcmd == CHECKDB_CMD &&
|
||||
(instance_config.logger.log_level_file != LOG_OFF &&
|
||||
instance_config.logger.log_directory == NULL) &&
|
||||
(!instance_config.pgdata || !instance_name))
|
||||
elog(ERROR, "Cannot save checkdb logs to a file. "
|
||||
"You must specify --log-directory option when running checkdb with "
|
||||
"--log-level-file option enabled.");
|
||||
|
Loading…
Reference in New Issue
Block a user