]> granicus.if.org Git - postgresql/commitdiff
Fix error reporting in reindexdb
authorMichael Paquier <michael@paquier.xyz>
Sat, 11 May 2019 04:00:54 +0000 (13:00 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sat, 11 May 2019 04:00:54 +0000 (13:00 +0900)
When failing to reindex a table or an index, reindexdb would generate an
extra error message related to a database failure, which is misleading.

Backpatch all the way down, as this has been introduced by 85e9a5a0.

Discussion: https://postgr.es/m/CAOBaU_Yo61RwNO3cW6WVYWwH7EYMPuexhKqufb2nFGOdunbcHw@mail.gmail.com
Author: Julien Rouhaud
Reviewed-by: Daniel Gustafsson, Álvaro Herrera, Tom Lane, Michael
Paquier
Backpatch-through: 9.4

src/bin/scripts/reindexdb.c

index d6f3efd313d3b7666de6a904df732f10fb33ffaf..897ad9a71a2c70415f69bec312683525f1d2ac2c 100644 (file)
@@ -325,10 +325,10 @@ reindex_one_database(const char *name, const char *dbname, const char *type,
                if (strcmp(type, "TABLE") == 0)
                        pg_log_error("reindexing of table \"%s\" in database \"%s\" failed: %s",
                                                 name, PQdb(conn), PQerrorMessage(conn));
-               if (strcmp(type, "INDEX") == 0)
+               else if (strcmp(type, "INDEX") == 0)
                        pg_log_error("reindexing of index \"%s\" in database \"%s\" failed: %s",
                                                 name, PQdb(conn), PQerrorMessage(conn));
-               if (strcmp(type, "SCHEMA") == 0)
+               else if (strcmp(type, "SCHEMA") == 0)
                        pg_log_error("reindexing of schema \"%s\" in database \"%s\" failed: %s",
                                                 name, PQdb(conn), PQerrorMessage(conn));
                else