From c99d85a3a5bca67af4938dbd6e58363733744257 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@otacoo.com>
Date: Tue, 23 Feb 2016 14:53:37 +0900
Subject: [PATCH 4/9] Remove password verifiers for unsupported protocols in
 pg_upgrade

This uses pg_auth_verifiers_sanitize to perform the cleanup in
pg_auth_verifiers that has been introduced previously.
---
 src/bin/pg_upgrade/pg_upgrade.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/bin/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
index 4f5361a..390d8ee 100644
--- a/src/bin/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -260,6 +260,18 @@ prepare_new_cluster(void)
 			  new_cluster.bindir, cluster_conn_opts(&new_cluster),
 			  log_opts.verbose ? "--verbose" : "");
 	check_ok();
+
+	/*
+	 * In order to ensure that the freshly-deployed cluster has no outdated
+	 * password verifier entries, sanitize pg_auth_verifiers using the
+	 * in-core function aimed at this purpose.
+	 */
+	prep_status("Removing password verifiers for unsupported protocols");
+	exec_prog(UTILITY_LOG_FILE, NULL, true,
+			  "\"%s/psql\" " EXEC_PSQL_ARGS
+			  " %s -c \"SELECT pg_auth_verifiers_sanitize()\"",
+			  new_cluster.bindir, cluster_conn_opts(&new_cluster));
+	check_ok();
 }
 
 
-- 
2.7.3

