On Mon, Aug 11, 2014 at 02:28:45PM -0400, Robert Haas wrote:
> On Mon, Aug 11, 2014 at 1:52 PM, Tom Lane <t...@sss.pgh.pa.us> wrote:
> > Robert Haas <robertmh...@gmail.com> writes:
> >> On Fri, Aug 8, 2014 at 9:34 PM, Peter Eisentraut <pete...@gmx.net> wrote:
> >>> What is the point of that change?
> >
> >> I think the output could justly be criticized for making it
> >> insufficiently clear that the parenthesized text is, in fact, the name
> >> of the pset parameter.
> >
> > Quite; that wasn't apparent to me either.
> >
> >> We could write something like:
> >> Border style (parameter "border") is 1.
> >
> > How about
> >
> > Border style (\pset border) is 1.
> 
> That would look just fine as a response to \a or \x, but I'm not sure
> it would look as good as a response to \pset, which prints out that
> line for every parameter ("why does every line say \pset when the
> command I just typed is \pset?").  However, I can certainly live with
> it if others prefer that to what I suggested.

I went with quoting the pset variable:

        test=> \a
        Output format ("format") is aligned.
        test=> \x
        Expanded display ("expanded") is on.

Patch attached.  I think this would be for 9.5 only, at this point.

-- 
  Bruce Momjian  <br...@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index 2227db4..76c3645 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -2538,9 +2538,9 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
 	if (strcmp(param, "border") == 0)
 	{
 		if (!popt->topt.border)
-			printf(_("Border style (%s) unset.\n"), param);
+			printf(_("Border style (\"%s\") unset.\n"), param);
 		else
-			printf(_("Border style (%s) is %d.\n"), param,
+			printf(_("Border style (\"%s\") is %d.\n"), param,
 				   popt->topt.border);
 	}
 
@@ -2548,9 +2548,9 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
 	else if (strcmp(param, "columns") == 0)
 	{
 		if (!popt->topt.columns)
-			printf(_("Target width (%s) unset.\n"), param);
+			printf(_("Target width (\"%s\") unset.\n"), param);
 		else
-			printf(_("Target width (%s) is %d.\n"), param,
+			printf(_("Target width (\"%s\") is %d.\n"), param,
 				   popt->topt.columns);
 	}
 
@@ -2558,58 +2558,58 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
 	else if (strcmp(param, "x") == 0 || strcmp(param, "expanded") == 0 || strcmp(param, "vertical") == 0)
 	{
 		if (popt->topt.expanded == 1)
-			printf(_("Expanded display (%s) is on.\n"), param);
+			printf(_("Expanded display (\"%s\") is on.\n"), param);
 		else if (popt->topt.expanded == 2)
-			printf(_("Expanded display (%s) is used automatically.\n"), param);
+			printf(_("Expanded display (\"%s\") is used automatically.\n"), param);
 		else
-			printf(_("Expanded display (%s) is off.\n"), param);
+			printf(_("Expanded display (\"%s\") is off.\n"), param);
 	}
 
 	/* show field separator for unaligned text */
 	else if (strcmp(param, "fieldsep") == 0)
 	{
 		if (popt->topt.fieldSep.separator_zero)
-			printf(_("Field separator (%s) is zero byte.\n"), param);
+			printf(_("Field separator (\"%s\") is zero byte.\n"), param);
 		else
-			printf(_("Field separator (%s) is \"%s\".\n"), param,
+			printf(_("Field separator (\"%s\") is \"%s\".\n"), param,
 				   popt->topt.fieldSep.separator);
 	}
 
 	else if (strcmp(param, "fieldsep_zero") == 0)
 	{
-		printf(_("Field separator (%s) is zero byte.\n"), param);
+		printf(_("Field separator (\"%s\") is zero byte.\n"), param);
 	}
 
 	/* show disable "(x rows)" footer */
 	else if (strcmp(param, "footer") == 0)
 	{
 		if (popt->topt.default_footer)
-			printf(_("Default footer (%s) is on.\n"), param);
+			printf(_("Default footer (\"%s\") is on.\n"), param);
 		else
-			printf(_("Default footer (%s) is off.\n"), param);
+			printf(_("Default footer (\"%s\") is off.\n"), param);
 	}
 
 	/* show format */
 	else if (strcmp(param, "format") == 0)
 	{
 		if (!popt->topt.format)
-			printf(_("Output format (%s) is aligned.\n"), param);
+			printf(_("Output format (\"%s\") is aligned.\n"), param);
 		else
-			printf(_("Output format (%s) is %s.\n"), param,
+			printf(_("Output format (\"%s\") is %s.\n"), param,
 				   _align2string(popt->topt.format));
 	}
 
 	/* show table line style */
 	else if (strcmp(param, "linestyle") == 0)
 	{
-		printf(_("Line style (%s) is %s.\n"), param,
+		printf(_("Line style (\"%s\") is %s.\n"), param,
 			   get_line_style(&popt->topt)->name);
 	}
 
 	/* show null display */
 	else if (strcmp(param, "null") == 0)
 	{
-		printf(_("Null display (%s) is \"%s\".\n"), param,
+		printf(_("Null display (\"%s\") is \"%s\".\n"), param,
 			   popt->nullPrint ? popt->nullPrint : "");
 	}
 
@@ -2617,65 +2617,65 @@ printPsetInfo(const char *param, struct printQueryOpt *popt)
 	else if (strcmp(param, "numericlocale") == 0)
 	{
 		if (popt->topt.numericLocale)
-			printf(_("Locale-adjusted numeric output (%s) is on.\n"), param);
+			printf(_("Locale-adjusted numeric output (\"%s\") is on.\n"), param);
 		else
-			printf(_("Locale-adjusted numeric output (%s) is off.\n"), param);
+			printf(_("Locale-adjusted numeric output (\"%s\") is off.\n"), param);
 	}
 
 	/* show toggle use of pager */
 	else if (strcmp(param, "pager") == 0)
 	{
 		if (popt->topt.pager == 1)
-			printf(_("Pager (%s) is used for long output.\n"), param);
+			printf(_("Pager (\"%s\") is used for long output.\n"), param);
 		else if (popt->topt.pager == 2)
-			printf(_("Pager (%s) is always used.\n"), param);
+			printf(_("Pager (\"%s\") is always used.\n"), param);
 		else
-			printf(_("Pager usage (%s) is off.\n"), param);
+			printf(_("Pager usage (\"%s\") is off.\n"), param);
 	}
 
 	/* show record separator for unaligned text */
 	else if (strcmp(param, "recordsep") == 0)
 	{
 		if (popt->topt.recordSep.separator_zero)
-			printf(_("Record separator (%s) is zero byte.\n"), param);
+			printf(_("Record separator (\"%s\") is zero byte.\n"), param);
 		else if (strcmp(popt->topt.recordSep.separator, "\n") == 0)
-			printf(_("Record separator (%s) is <newline>.\n"), param);
+			printf(_("Record separator (\"%s\") is <newline>.\n"), param);
 		else
-			printf(_("Record separator (%s) is \"%s\".\n"), param,
+			printf(_("Record separator (\"%s\") is \"%s\".\n"), param,
 				   popt->topt.recordSep.separator);
 	}
 
 	else if (strcmp(param, "recordsep_zero") == 0)
 	{
-		printf(_("Record separator (%s) is zero byte.\n"), param);
+		printf(_("Record separator (\"%s\") is zero byte.\n"), param);
 	}
 
 	/* show HTML table tag options */
 	else if (strcmp(param, "T") == 0 || strcmp(param, "tableattr") == 0)
 	{
 		if (popt->topt.tableAttr)
-			printf(_("Table attributes (%s) are \"%s\".\n"), param,
+			printf(_("Table attributes (\"%s\") are \"%s\".\n"), param,
 				   popt->topt.tableAttr);
 		else
-			printf(_("Table attributes (%s) unset.\n"), param);
+			printf(_("Table attributes (\"%s\") unset.\n"), param);
 	}
 
 	/* show title override */
 	else if (strcmp(param, "title") == 0)
 	{
 		if (popt->title)
-			printf(_("Title (%s) is \"%s\".\n"), param, popt->title);
+			printf(_("Title (\"%s\") is \"%s\".\n"), param, popt->title);
 		else
-			printf(_("Title (%s) unset.\n"), param);
+			printf(_("Title (\"%s\") unset.\n"), param);
 	}
 
 	/* show toggle between full and tuples-only format */
 	else if (strcmp(param, "t") == 0 || strcmp(param, "tuples_only") == 0)
 	{
 		if (popt->topt.tuples_only)
-			printf(_("Tuples only (%s) is on.\n"), param);
+			printf(_("Tuples only (\"%s\") is on.\n"), param);
 		else
-			printf(_("Tuples only (%s) is off.\n"), param);
+			printf(_("Tuples only (\"%s\") is off.\n"), param);
 	}
 
 	/* unicode style formatting */
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to