Recent patch allowed \timing [on|off]
This patch allows same option on all remaining toggles, so every option
works in the same way. We now have the ability to do
\a [on|off]
\H [on|off]
Patch also corrects help, which didn't show that \x and \t could already
be directly set, even though help said they were toggles.
--
Simon Riggs www.2ndQuadrant.com
PostgreSQL Training, Services and Support
Index: src/bin/psql/command.c
===
RCS file: /home/sriggs/pg/REPOSITORY/pgsql/src/bin/psql/command.c,v
retrieving revision 1.190
diff -c -r1.190 command.c
*** src/bin/psql/command.c 11 Jun 2008 10:48:17 - 1.190
--- src/bin/psql/command.c 5 Jul 2008 12:15:02 -
***
*** 182,191
*/
if (strcmp(cmd, "a") == 0)
{
! if (pset.popt.topt.format != PRINT_ALIGNED)
! success = do_pset("format", "aligned", &pset.popt, pset.quiet);
else
! success = do_pset("format", "unaligned", &pset.popt, pset.quiet);
}
/* \C -- override table title (formerly change HTML caption) */
--- 182,203
*/
if (strcmp(cmd, "a") == 0)
{
! char *opt = psql_scan_slash_option(scan_state,
! OT_NORMAL, NULL, false);
! if (opt)
! {
! if (ParseVariableBool(opt))
! success = do_pset("format", "aligned", &pset.popt, pset.quiet);
! else
! success = do_pset("format", "unaligned", &pset.popt, pset.quiet);
! }
else
! {
! if (pset.popt.topt.format != PRINT_ALIGNED)
! success = do_pset("format", "aligned", &pset.popt, pset.quiet);
! else
! success = do_pset("format", "unaligned", &pset.popt, pset.quiet);
! }
}
/* \C -- override table title (formerly change HTML caption) */
***
*** 538,547
/* HTML mode */
else if (strcmp(cmd, "H") == 0 || strcmp(cmd, "html") == 0)
{
! if (pset.popt.topt.format != PRINT_HTML)
! success = do_pset("format", "html", &pset.popt, pset.quiet);
else
! success = do_pset("format", "aligned", &pset.popt, pset.quiet);
}
--- 550,571
/* HTML mode */
else if (strcmp(cmd, "H") == 0 || strcmp(cmd, "html") == 0)
{
! char *opt = psql_scan_slash_option(scan_state,
! OT_NORMAL, NULL, false);
! if (opt)
! {
! if (ParseVariableBool(opt))
! success = do_pset("format", "html", &pset.popt, pset.quiet);
! else
! success = do_pset("format", "aligned", &pset.popt, pset.quiet);
! }
else
! {
! if (pset.popt.topt.format != PRINT_HTML)
! success = do_pset("format", "html", &pset.popt, pset.quiet);
! else
! success = do_pset("format", "aligned", &pset.popt, pset.quiet);
! }
}
Index: src/bin/psql/help.c
===
RCS file: /home/sriggs/pg/REPOSITORY/pgsql/src/bin/psql/help.c,v
retrieving revision 1.129
diff -c -r1.129 help.c
*** src/bin/psql/help.c 11 Jun 2008 10:55:43 - 1.129
--- src/bin/psql/help.c 5 Jul 2008 12:30:39 -
***
*** 220,237
fprintf(output, "\n");
fprintf(output, _("Formatting\n"));
! fprintf(output, _(" \\a toggle between unaligned and aligned output mode\n"));
fprintf(output, _(" \\C [STRING]set table title, or unset if none\n"));
fprintf(output, _(" \\f [STRING]show or set field separator for unaligned query output\n"));
! fprintf(output, _(" \\H toggle HTML output mode (currently %s)\n"),
ON(pset.popt.topt.format == PRINT_HTML));
fprintf(output, _(" \\pset NAME [VALUE] set table output option\n"
" (NAME := {format|border|expanded|fieldsep|footer|null|\n"
" numericlocale|recordsep|tuples_only|title|tableattr|pager})\n"));
! fprintf(output, _(" \\t show only rows (currently %s)\n"),
ON(pset.popt.topt.tuples_only));
fprintf(output, _(" \\T [STRING]set HTML tag attributes, or unset if none\n"));
! fprintf(output, _(" \\x toggle expanded output (currently %s)\n"),
ON(pset.popt.topt.expanded));
fprintf(output, "\n");
--- 220,237
fprintf(output, "\n");
fprintf(output, _("Formatting\n"));
! fprintf(output, _(" \\a [on|off]toggle between unaligned and aligned output mode\n"));
fprintf(output, _(" \\C [STRING]set table title, or unset if none\n"));
fprintf(output, _(" \\f [STRING]show or set field separator for unaligned query output\n"));
! fprintf(output, _(" \\H [on|off]toggle or set HTML output mode (currently %s)\n"),
ON(pset.popt.topt.format == PRINT_HTML));
fprintf(output, _(" \\pset NAME [VALUE] set table output option\n"
" (NAME := {format|border|expanded|fieldsep|footer|null|\n"
" numericlocale|recordsep|tuples_only|title|tableattr|pager})\n"));
! fprintf(output, _(" \\t [on|off]toggle or set showing rows only (currently %s)\n"),
ON(pset.popt.topt.tuples_on