Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGVGr-00081W-MN for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2019 21:37:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iGVGp-0000cE-Cp for pgsql-hackers@arkaria.postgresql.org; Fri, 04 Oct 2019 21:37:51 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iGVGp-0000bx-1M for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2019 21:37:51 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iGVGm-0006fv-LA for pgsql-hackers@lists.postgresql.org; Fri, 04 Oct 2019 21:37:50 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1iGVGk-0005dT-Ag; Fri, 04 Oct 2019 17:37:46 -0400 Date: Fri, 4 Oct 2019 17:37:46 -0400 From: Bruce Momjian To: Justin Pryzby Cc: pgsql-hackers@lists.postgresql.org, Daniel Gustafsson Subject: Re: format of pg_upgrade loadable_libraries warning Message-ID: <20191004213746.GD29227@momjian.us> References: <20191002172337.GC9680@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: <20191002172337.GC9680@telsasoft.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Oct 2, 2019 at 12:23:37PM -0500, Justin Pryzby wrote: > Regarding the previous thread and commit here: > https://www.postgresql.org/message-id/flat/20180713162815.GA3835%40momjian.us > https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=60e3bd1d7f92430b24b710ecf0559656eb8ed499 > > I'm suggesting to reformat the warning, which I found to be misleading: > > |could not load library "$libdir/pgfincore": ERROR: could not access file "$libdir/pgfincore": No such file or directory > |Database: postgres > |Database: too > > To me that reads as "error message" followed by successful processing of two, > named database, and not "error message followed by list of databases for which > that error was experienced". Essentially, the database names are themselves > the "error", and the message is a prefix indicating the library version; but > normally, error-looking things are output without a "prefix", since they > weren't anticipated. > > The existing check is optimized to check each library once, but then outputs > each database which would try to load it. That's an implementation detail, but > adds to confusion, since it shows a single error-looking thing which might > apply to multiple DBs (not obvious to me that it's associated with an DB at > all). That leads me to believe that after I "DROP EXTENSION" once, I can > reasonably expect the upgrade to complete, which has a good chance of being > wrong, and is exactly what the patch was intended to avoid :( Understood. This is a general problem with the way pg_upgrade displays errors and the databases/objects associated with them. The attached patch fixes the output text to say "in database", e.g.: Could not load library "$libdir/pgfincore": ERROR: could not access file "$libdir/pgfincore": No such file or directory in database: postgres in database: too Would intenting help too? I am inclined to fix this only head, and not to backpatch the change. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + --x+6KMIRAuhnl3hBn Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="error-found.diff" diff --git a/src/bin/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c new file mode 100644 index 617270f..1bbb57c *** a/src/bin/pg_upgrade/check.c --- b/src/bin/pg_upgrade/check.c *************** check_for_isn_and_int8_passing_mismatch( *** 858,864 **** output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "Database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s\n", --- 858,864 ---- output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "in database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s\n", *************** check_for_tables_with_oids(ClusterInfo * *** 937,943 **** output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "Database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s\n", --- 937,943 ---- output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "in database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s\n", *************** check_for_reg_data_type_usage(ClusterInf *** 1046,1052 **** output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "Database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", --- 1046,1052 ---- output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "in database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", *************** check_for_jsonb_9_4_usage(ClusterInfo *c *** 1137,1143 **** output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "Database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", --- 1137,1143 ---- output_path, strerror(errno)); if (!db_used) { ! fprintf(script, "in database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", diff --git a/src/bin/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c new file mode 100644 index 0c66d1c..506fd34 *** a/src/bin/pg_upgrade/function.c --- b/src/bin/pg_upgrade/function.c *************** check_loadable_libraries(void) *** 256,262 **** } if (was_load_failure) ! fprintf(script, _("Database: %s\n"), old_cluster.dbarr.dbs[os_info.libraries[libnum].dbnum].db_name); } --- 256,262 ---- } if (was_load_failure) ! fprintf(script, _("in database: %s\n"), old_cluster.dbarr.dbs[os_info.libraries[libnum].dbnum].db_name); } diff --git a/src/bin/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c new file mode 100644 index 10cb362..fba7c6c *** a/src/bin/pg_upgrade/version.c --- b/src/bin/pg_upgrade/version.c *************** old_9_3_check_for_line_data_type_usage(C *** 157,163 **** strerror(errno)); if (!db_used) { ! fprintf(script, "Database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", --- 157,163 ---- strerror(errno)); if (!db_used) { ! fprintf(script, "in database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", *************** old_9_6_check_for_unknown_data_type_usag *** 258,264 **** strerror(errno)); if (!db_used) { ! fprintf(script, "Database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", --- 258,264 ---- strerror(errno)); if (!db_used) { ! fprintf(script, "in database: %s\n", active_db->db_name); db_used = true; } fprintf(script, " %s.%s.%s\n", --x+6KMIRAuhnl3hBn--