diff --git a/src/backup.c b/src/backup.c index 132ad228..6acbda70 100644 --- a/src/backup.c +++ b/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 */ diff --git a/src/pg_probackup.c b/src/pg_probackup.c index a1e9652e..dc40fe1c 100644 --- a/src/pg_probackup.c +++ b/src/pg_probackup.c @@ -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.");