From 72679f3c7d8b56b2a1f341d389f79040ccca9dd2 Mon Sep 17 00:00:00 2001
From: Justin Pryzby <pryzbyj@telsasoft.com>
Date: Thu, 15 Jul 2021 03:23:25 -0500
Subject: [PATCH v2 4/5] f! change if (verbose) to if (verbose > 0)

---
 src/bin/psql/command.c  |   4 +-
 src/bin/psql/describe.c | 112 ++++++++++++++++++++--------------------
 2 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 34f1ee54b5..c3738a106f 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -876,7 +876,7 @@ exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd)
 				switch (cmd[2])
 				{
 					case 'p':
-						if (verbose)
+						if (verbose > 0)
 							success = describePublications(pattern);
 						else
 							success = listPublications(pattern);
@@ -933,7 +933,7 @@ exec_command_d(PsqlScanState scan_state, bool active_branch, const char *cmd)
 				}
 				break;
 			case 'x':			/* Extensions */
-				if (verbose)
+				if (verbose > 0)
 					success = listExtensionContents(pattern);
 				else
 					success = listExtensions(pattern);
diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c
index afdb330d41..4d76f117c3 100644
--- a/src/bin/psql/describe.c
+++ b/src/bin/psql/describe.c
@@ -177,7 +177,7 @@ describeAccessMethods(const char *pattern, int verbose)
 					  gettext_noop("Table"),
 					  gettext_noop("Type"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBuffer(&buf,
 						  ",\n  amhandler AS \"%s\",\n"
@@ -252,13 +252,13 @@ describeTablespaces(const char *pattern, int verbose)
 						  gettext_noop("Owner"),
 						  gettext_noop("Location"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "spcacl");
 	}
 
-	if (verbose && pset.sversion >= 90000)
+	if (verbose > 0 && pset.sversion >= 90000)
 		appendPQExpBuffer(&buf,
 						  ",\n  spcoptions AS \"%s\"",
 						  gettext_noop("Options"));
@@ -268,7 +268,7 @@ describeTablespaces(const char *pattern, int verbose)
 						  ",\n  pg_catalog.pg_size_pretty(pg_catalog.pg_tablespace_size(oid)) AS \"%s\"",
 						  gettext_noop("Size"));
 
-	if (verbose && pset.sversion >= 80200)
+	if (verbose > 0 && pset.sversion >= 80200)
 		appendPQExpBuffer(&buf,
 						  ",\n  pg_catalog.shobj_description(oid, 'pg_tablespace') AS \"%s\"",
 						  gettext_noop("Description"));
@@ -475,7 +475,7 @@ describeFunctions(const char *functypes, const char *func_pattern,
 						  gettext_noop("func"),
 						  gettext_noop("Type"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBuffer(&buf,
 						  ",\n CASE\n"
@@ -535,7 +535,7 @@ describeFunctions(const char *functypes, const char *func_pattern,
 						  i, i, i, i, i, i);
 	}
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "     LEFT JOIN pg_catalog.pg_language l ON l.oid = p.prolang\n");
 
@@ -727,7 +727,7 @@ describeTypes(const char *pattern, int verbose, bool showSystem)
 					  "  pg_catalog.format_type(t.oid, NULL) AS \"%s\",\n",
 					  gettext_noop("Schema"),
 					  gettext_noop("Name"));
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  "  t.typname AS \"%s\",\n"
 						  "  CASE WHEN t.typrelid != 0\n"
@@ -738,7 +738,7 @@ describeTypes(const char *pattern, int verbose, bool showSystem)
 						  "  END AS \"%s\",\n",
 						  gettext_noop("Internal name"),
 						  gettext_noop("Size"));
-	if (verbose && pset.sversion >= 80300)
+	if (verbose > 0 && pset.sversion >= 80300)
 	{
 		appendPQExpBufferStr(&buf,
 							 "  pg_catalog.array_to_string(\n"
@@ -760,13 +760,13 @@ describeTypes(const char *pattern, int verbose, bool showSystem)
 						  "  ) AS \"%s\",\n",
 						  gettext_noop("Elements"));
 	}
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBuffer(&buf,
 						  "  pg_catalog.pg_get_userbyid(t.typowner) AS \"%s\",\n",
 						  gettext_noop("Owner"));
 	}
-	if (verbose && pset.sversion >= 90200)
+	if (verbose > 0 && pset.sversion >= 90200)
 	{
 		printACLColumn(&buf, "t.typacl");
 		appendPQExpBufferStr(&buf, ",\n  ");
@@ -927,7 +927,7 @@ describeOperators(const char *oper_pattern,
 					  gettext_noop("Right arg type"),
 					  gettext_noop("Result type"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  "  o.oprcode AS \"%s\",\n",
 						  gettext_noop("Function"));
@@ -1053,17 +1053,17 @@ listAllDbs(const char *pattern, int verbose)
 						  "            ELSE 'No Access'\n"
 						  "       END as \"%s\"",
 						  gettext_noop("Size"));
-	if (verbose && pset.sversion >= 80000)
+	if (verbose > 0 && pset.sversion >= 80000)
 		appendPQExpBuffer(&buf,
 						  ",\n       t.spcname as \"%s\"",
 						  gettext_noop("Tablespace"));
-	if (verbose && pset.sversion >= 80200)
+	if (verbose > 0 && pset.sversion >= 80200)
 		appendPQExpBuffer(&buf,
 						  ",\n       pg_catalog.shobj_description(d.oid, 'pg_database') as \"%s\"",
 						  gettext_noop("Description"));
 	appendPQExpBufferStr(&buf,
 						 "\nFROM pg_catalog.pg_database d\n");
-	if (verbose && pset.sversion >= 80000)
+	if (verbose > 0 && pset.sversion >= 80000)
 		appendPQExpBufferStr(&buf,
 							 "  JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid\n");
 
@@ -2050,7 +2050,7 @@ describeOneTableDetails(const char *schemaname,
 							 "  pg_catalog.pg_options_to_table(attfdwoptions)), ', ') || ')' END AS attfdwoptions");
 		fdwopts_col = cols++;
 	}
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBufferStr(&buf, ",\n  a.attstorage");
 		attstorage_col = cols++;
@@ -2313,7 +2313,7 @@ describeOneTableDetails(const char *schemaname,
 						  "false as inhdetachpending");
 
 		/* If verbose, also request the partition constraint definition */
-		if (verbose)
+		if (verbose > 0)
 			appendPQExpBufferStr(&buf,
 								 ",\n  pg_catalog.pg_get_partition_constraintdef(c.oid)");
 		appendPQExpBuffer(&buf,
@@ -2336,7 +2336,7 @@ describeOneTableDetails(const char *schemaname,
 							  strcmp(detached, "t") == 0 ? " DETACH PENDING" : "");
 			printTableAddFooter(&cont, tmpbuf.data);
 
-			if (verbose)
+			if (verbose > 0)
 			{
 				char	   *partconstraintdef = NULL;
 
@@ -3543,7 +3543,7 @@ describeOneTableDetails(const char *schemaname,
 			printfPQExpBuffer(&buf, _("Number of partitions: %d"), tuples);
 			printTableAddFooter(&cont, buf.data);
 		}
-		else if (!verbose)
+		else if (verbose == 0)
 		{
 			/* print the number of child tables, if any */
 			if (tuples > 0)
@@ -3593,7 +3593,7 @@ describeOneTableDetails(const char *schemaname,
 			printTableAddFooter(&cont, buf.data);
 		}
 
-		if (verbose &&
+		if (verbose > 0 &&
 			(tableinfo.relkind == RELKIND_RELATION ||
 			 tableinfo.relkind == RELKIND_MATVIEW) &&
 
@@ -3617,7 +3617,7 @@ describeOneTableDetails(const char *schemaname,
 		}
 
 		/* OIDs, if verbose and not a materialized view */
-		if (verbose && tableinfo.relkind != RELKIND_MATVIEW && tableinfo.hasoids)
+		if (verbose > 0 && tableinfo.relkind != RELKIND_MATVIEW && tableinfo.hasoids)
 			printTableAddFooter(&cont, _("Has OIDs: yes"));
 
 		/* Tablespace info */
@@ -3625,7 +3625,7 @@ describeOneTableDetails(const char *schemaname,
 							  true);
 
 		/* Access method info */
-		if (verbose && tableinfo.relam != NULL && !pset.hide_tableam)
+		if (verbose > 0 && tableinfo.relam != NULL && !pset.hide_tableam)
 		{
 			printfPQExpBuffer(&buf, _("Access method: %s"), tableinfo.relam);
 			printTableAddFooter(&cont, buf.data);
@@ -3633,7 +3633,7 @@ describeOneTableDetails(const char *schemaname,
 	}
 
 	/* reloptions, if verbose */
-	if (verbose &&
+	if (verbose > 0 &&
 		tableinfo.reloptions && tableinfo.reloptions[0] != '\0')
 	{
 		const char *t = _("Options");
@@ -3764,7 +3764,7 @@ describeRoles(const char *pattern, int verbose, bool showSystem)
 						  "        JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)\n"
 						  "        WHERE m.member = r.oid) as memberof");
 
-		if (verbose && pset.sversion >= 80200)
+		if (verbose > 0 && pset.sversion >= 80200)
 		{
 			appendPQExpBufferStr(&buf, "\n, pg_catalog.shobj_description(r.oid, 'pg_authid') AS description");
 			ncols++;
@@ -3819,7 +3819,7 @@ describeRoles(const char *pattern, int verbose, bool showSystem)
 	/* ignores implicit memberships from superuser & pg_database_owner */
 	printTableAddHeader(&cont, gettext_noop("Member of"), true, align);
 
-	if (verbose && pset.sversion >= 80200)
+	if (verbose > 0 && pset.sversion >= 80200)
 		printTableAddHeader(&cont, gettext_noop("Description"), true, align);
 
 	for (i = 0; i < nrows; i++)
@@ -3879,7 +3879,7 @@ describeRoles(const char *pattern, int verbose, bool showSystem)
 
 		printTableAddCell(&cont, PQgetvalue(res, i, 8), false, false);
 
-		if (verbose && pset.sversion >= 80200)
+		if (verbose > 0 && pset.sversion >= 80200)
 			printTableAddCell(&cont, PQgetvalue(res, i, 9), false, false);
 	}
 	termPQExpBuffer(&buf);
@@ -4057,7 +4057,7 @@ listTables(const char *tabtypes, const char *pattern, int verbose, bool showSyst
 		cols_so_far++;
 	}
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		/*
 		 * Show whether a relation is permanent, temporary, or unlogged.  Like
@@ -4283,7 +4283,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 						  ",\n c2.oid::regclass as \"%s\"",
 						  gettext_noop("Table"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		if (showNested)
 		{
@@ -4318,7 +4318,7 @@ listPartitionedTables(const char *reltypes, const char *pattern, int verbose)
 		appendPQExpBufferStr(&buf,
 							 "\n     LEFT JOIN pg_catalog.pg_inherits inh ON c.oid = inh.inhrelid");
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		if (pset.sversion < 120000)
 		{
@@ -4424,7 +4424,7 @@ listLanguages(const char *pattern, int verbose, bool showSystem)
 					  "       l.lanpltrusted AS \"%s\"",
 					  gettext_noop("Trusted"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBuffer(&buf,
 						  ",\n       NOT l.lanispl AS \"%s\",\n"
@@ -4510,7 +4510,7 @@ listDomains(const char *pattern, int verbose, bool showSystem)
 					  gettext_noop("Default"),
 					  gettext_noop("Check"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		if (pset.sversion >= 90200)
 		{
@@ -4526,7 +4526,7 @@ listDomains(const char *pattern, int verbose, bool showSystem)
 						 "\nFROM pg_catalog.pg_type t\n"
 						 "     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n");
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "     LEFT JOIN pg_catalog.pg_description d "
 							 "ON d.classoid = t.tableoid AND d.objoid = t.oid "
@@ -4589,7 +4589,7 @@ listConversions(const char *pattern, int verbose, bool showSystem)
 					  gettext_noop("yes"), gettext_noop("no"),
 					  gettext_noop("Default?"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n       d.description AS \"%s\"",
 						  gettext_noop("Description"));
@@ -4599,7 +4599,7 @@ listConversions(const char *pattern, int verbose, bool showSystem)
 						 "     JOIN pg_catalog.pg_namespace n "
 						 "ON n.oid = c.connamespace\n");
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "LEFT JOIN pg_catalog.pg_description d "
 							 "ON d.classoid = c.tableoid\n"
@@ -4672,7 +4672,7 @@ listEventTriggers(const char *pattern, int verbose)
 					  gettext_noop("Enabled"),
 					  gettext_noop("Function"),
 					  gettext_noop("Tags"));
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\npg_catalog.obj_description(e.oid, 'pg_event_trigger') as \"%s\"",
 						  gettext_noop("Description"));
@@ -4847,7 +4847,7 @@ listCasts(const char *pattern, int verbose)
 					  gettext_noop("yes"),
 					  gettext_noop("Implicit?"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n       d.description AS \"%s\"",
 						  gettext_noop("Description"));
@@ -4868,7 +4868,7 @@ listCasts(const char *pattern, int verbose)
 						 "     LEFT JOIN pg_catalog.pg_namespace nt\n"
 						 "     ON nt.oid = tt.typnamespace\n");
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "     LEFT JOIN pg_catalog.pg_description d\n"
 							 "     ON d.classoid = c.tableoid AND d.objoid = "
@@ -4966,7 +4966,7 @@ listCollations(const char *pattern, int verbose, bool showSystem)
 						  gettext_noop("yes"),
 						  gettext_noop("Deterministic?"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n       pg_catalog.obj_description(c.oid, 'pg_collation') AS \"%s\"",
 						  gettext_noop("Description"));
@@ -5029,7 +5029,7 @@ listSchemas(const char *pattern, int verbose, bool showSystem)
 					  gettext_noop("Name"),
 					  gettext_noop("Owner"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "n.nspacl");
@@ -5096,7 +5096,7 @@ listTSParsers(const char *pattern, int verbose)
 		return true;
 	}
 
-	if (verbose)
+	if (verbose > 0)
 		return listTSParsersVerbose(pattern);
 
 	initPQExpBuffer(&buf);
@@ -5352,7 +5352,7 @@ listTSDictionaries(const char *pattern, int verbose)
 					  gettext_noop("Schema"),
 					  gettext_noop("Name"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBuffer(&buf,
 						  "  ( SELECT COALESCE(nt.nspname, '(null)')::pg_catalog.text || '.' || t.tmplname FROM\n"
@@ -5416,7 +5416,7 @@ listTSTemplates(const char *pattern, int verbose)
 
 	initPQExpBuffer(&buf);
 
-	if (verbose)
+	if (verbose > 0)
 		printfPQExpBuffer(&buf,
 						  "SELECT\n"
 						  "  n.nspname AS \"%s\",\n"
@@ -5485,7 +5485,7 @@ listTSConfigs(const char *pattern, int verbose)
 		return true;
 	}
 
-	if (verbose)
+	if (verbose > 0)
 		return listTSConfigsVerbose(pattern);
 
 	initPQExpBuffer(&buf);
@@ -5705,7 +5705,7 @@ listForeignDataWrappers(const char *pattern, int verbose)
 					  "  fdw.fdwvalidator::pg_catalog.regproc AS \"%s\"",
 					  gettext_noop("Validator"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "fdwacl");
@@ -5726,7 +5726,7 @@ listForeignDataWrappers(const char *pattern, int verbose)
 
 	appendPQExpBufferStr(&buf, "\nFROM pg_catalog.pg_foreign_data_wrapper fdw\n");
 
-	if (verbose && pset.sversion >= 90100)
+	if (verbose > 0 && pset.sversion >= 90100)
 		appendPQExpBufferStr(&buf,
 							 "LEFT JOIN pg_catalog.pg_description d\n"
 							 "       ON d.classoid = fdw.tableoid "
@@ -5783,7 +5783,7 @@ listForeignServers(const char *pattern, int verbose)
 					  gettext_noop("Owner"),
 					  gettext_noop("Foreign-data wrapper"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		appendPQExpBufferStr(&buf, ",\n  ");
 		printACLColumn(&buf, "s.srvacl");
@@ -5808,7 +5808,7 @@ listForeignServers(const char *pattern, int verbose)
 						 "\nFROM pg_catalog.pg_foreign_server s\n"
 						 "     JOIN pg_catalog.pg_foreign_data_wrapper f ON f.oid=s.srvfdw\n");
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "LEFT JOIN pg_catalog.pg_description d\n       "
 							 "ON d.classoid = s.tableoid AND d.objoid = s.oid "
@@ -5863,7 +5863,7 @@ listUserMappings(const char *pattern, int verbose)
 					  gettext_noop("Server"),
 					  gettext_noop("User name"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n CASE WHEN umoptions IS NULL THEN '' ELSE "
 						  "  '(' || pg_catalog.array_to_string(ARRAY(SELECT "
@@ -5926,7 +5926,7 @@ listForeignTables(const char *pattern, int verbose)
 					  gettext_noop("Table"),
 					  gettext_noop("Server"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n CASE WHEN ftoptions IS NULL THEN '' ELSE "
 						  "  '(' || pg_catalog.array_to_string(ARRAY(SELECT "
@@ -5946,7 +5946,7 @@ listForeignTables(const char *pattern, int verbose)
 						 " ON n.oid = c.relnamespace\n"
 						 "  INNER JOIN pg_catalog.pg_foreign_server s"
 						 " ON s.oid = ft.ftserver\n");
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "   LEFT JOIN pg_catalog.pg_description d\n"
 							 "          ON d.classoid = c.tableoid AND "
@@ -6420,7 +6420,7 @@ describeSubscriptions(const char *pattern, int verbose)
 					  gettext_noop("Enabled"),
 					  gettext_noop("Publication"));
 
-	if (verbose)
+	if (verbose > 0)
 	{
 		/* Binary mode and streaming are only supported in v14 and higher */
 		if (pset.sversion >= 140000)
@@ -6536,7 +6536,7 @@ listOperatorClasses(const char *access_method_pattern,
 					  gettext_noop("yes"),
 					  gettext_noop("no"),
 					  gettext_noop("Default?"));
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n  CASE\n"
 						  "    WHEN pg_catalog.pg_opfamily_is_visible(of.oid)\n"
@@ -6552,7 +6552,7 @@ listOperatorClasses(const char *access_method_pattern,
 						 "  LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.opcnamespace\n"
 						 "  LEFT JOIN pg_catalog.pg_type t ON t.oid = c.opcintype\n"
 						 "  LEFT JOIN pg_catalog.pg_namespace tn ON tn.oid = t.typnamespace\n");
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "  LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = c.opcfamily\n"
 							 "  LEFT JOIN pg_catalog.pg_namespace ofn ON ofn.oid = of.opfnamespace\n");
@@ -6620,7 +6620,7 @@ listOperatorFamilies(const char *access_method_pattern,
 					  gettext_noop("AM"),
 					  gettext_noop("Operator family"),
 					  gettext_noop("Applicable types"));
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ",\n  pg_catalog.pg_get_userbyid(f.opfowner) AS \"%s\"\n",
 						  gettext_noop("Owner"));
@@ -6710,7 +6710,7 @@ listOpFamilyOperators(const char *access_method_pattern,
 					  gettext_noop("search"),
 					  gettext_noop("Purpose"));
 
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBuffer(&buf,
 						  ", ofs.opfname AS \"%s\"\n",
 						  gettext_noop("Sort opfamily"));
@@ -6719,7 +6719,7 @@ listOpFamilyOperators(const char *access_method_pattern,
 						 "  LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = o.amopfamily\n"
 						 "  LEFT JOIN pg_catalog.pg_am am ON am.oid = of.opfmethod AND am.oid = o.amopmethod\n"
 						 "  LEFT JOIN pg_catalog.pg_namespace nsf ON of.opfnamespace = nsf.oid\n");
-	if (verbose)
+	if (verbose > 0)
 		appendPQExpBufferStr(&buf,
 							 "  LEFT JOIN pg_catalog.pg_opfamily ofs ON ofs.oid = o.amopsortfamily\n");
 
@@ -6791,7 +6791,7 @@ listOpFamilyFunctions(const char *access_method_pattern,
 					  gettext_noop("Registered right type"),
 					  gettext_noop("Number"));
 
-	if (!verbose)
+	if (verbose == 0)
 		appendPQExpBuffer(&buf,
 						  ", p.proname AS \"%s\"\n",
 						  gettext_noop("Function"));
-- 
2.17.0

