<!--
-$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.187 2007/02/23 18:20:58 momjian Exp $
+$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.188 2007/03/03 17:19:11 momjian Exp $
PostgreSQL documentation
-->
<term><literal>expanded</literal> (or <literal>x</literal>)</term>
<listitem>
<para>
- Toggles between regular and expanded format. When expanded
- format is enabled, query results are displayed in two
- columns, with the column name on the left and the data on
- the right. This mode is useful if the data wouldn't fit on the
- screen in the normal <quote>horizontal</quote> mode.
+ You can specify an optional second argument, if it is provided it
+ may be either <literal>on</literal> or <literal>off</literal>
+ which will enable or disable expanded mode. If the second
+ argument is not provided then we will toggle between regular and
+ expanded format. When expanded format is enabled, query results
+ are displayed in two columns, with the column name on the left and
+ the data on the right. This mode is useful if the data wouldn't fit
+ on the screen in the normal <quote>horizontal</quote> mode.
</para>
<para>
<term><literal>footer</literal></term>
<listitem>
<para>
- Toggles the display of the default footer <literal>(x
- rows)</literal>.
+ You can specify an optional second argument, if it is provided it
+ may be either <literal>on</literal> or <literal>off</literal>
+ which will enable or disable display of the default footer
+ <literal>(x rows)</literal>. If the second argument is not
+ provided then we will toggle between on and off.
</para>
</listitem>
</varlistentry>
<term><literal>numericlocale</literal></term>
<listitem>
<para>
- Toggles the display of a locale-aware character to separate groups
- of digits to the left of the decimal marker. It also enables
- a locale-aware decimal marker.
+ You can specify an optional second argument, if it is provided it
+ may be either <literal>on</literal> or <literal>off</literal>
+ which will enable or disable display of a locale-aware character
+ to seperate groups of digits to the left of the decimal marker. If
+ the second argument is not provided then we will toggle between
+ on and off.
</para>
</listitem>
</varlistentry>
<term><literal>tuples_only</literal> (or <literal>t</literal>)</term>
<listitem>
<para>
- Toggles between tuples only and full display. Full display
- shows extra information such as column headers, titles, and
- various footers. In tuples only mode, only actual table data
- is shown.
+ You can specify an optional second argument, if it is provided it
+ may be either <literal>on</literal> or <literal>off</literal>
+ which will enable or display the tuples only mode. If the
+ second argument is not provided then we will toggle between tuples
+ only and full display. Full display shows extra information such
+ as column headers, titles, and various footers. In tuples only
+ mode, only actual table data is shown.
</para>
</listitem>
</varlistentry>
(<application>psql</> does not do a perfect job of estimating
when to use the pager.) <literal>\pset pager</> turns the
pager on and off. Pager can also be set to <literal>always</>,
- which causes the pager to be always used.
+ which causes the pager to be always used, or you can set the pager
+ to <literal>on</> which will enable the usage of the pager when
+ appropriate, or you can set the pager to <literal>off</> which
+ will disable the pager.
</para>
</listitem>
</varlistentry>
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.178 2007/02/23 18:20:58 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.179 2007/03/03 17:19:11 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
/* \t -- turn off headers and row count */
else if (strcmp(cmd, "t") == 0)
- success = do_pset("tuples_only", NULL, &pset.popt, pset.quiet);
+ {
+ char *opt = psql_scan_slash_option(scan_state,
+ OT_NORMAL, NULL, true);
+
+ success = do_pset("tuples_only", opt, &pset.popt, pset.quiet);
+ free(opt);
+ }
/* \T -- define html <table ...> attributes */
/* \x -- toggle expanded table representation */
else if (strcmp(cmd, "x") == 0)
- success = do_pset("expanded", NULL, &pset.popt, pset.quiet);
+ {
+ char *opt = psql_scan_slash_option(scan_state,
+ OT_NORMAL, NULL, true);
+
+ success = do_pset("expanded", opt, &pset.popt, pset.quiet);
+ free(opt);
+ }
/* \z -- list table rights (equivalent to \dp) */
else if (strcmp(cmd, "z") == 0)
/* set expanded/vertical mode */
else if (strcmp(param, "x") == 0 || strcmp(param, "expanded") == 0 || strcmp(param, "vertical") == 0)
{
- popt->topt.expanded = !popt->topt.expanded;
+ if (value)
+ popt->topt.expanded = ParseVariableBool(value);
+ else
+ popt->topt.expanded = !popt->topt.expanded;
if (!quiet)
printf(popt->topt.expanded
? _("Expanded display is on.\n")
/* locale-aware numeric output */
else if (strcmp(param, "numericlocale") == 0)
{
- popt->topt.numericLocale = !popt->topt.numericLocale;
+ if (value)
+ popt->topt.numericLocale = ParseVariableBool(value);
+ else
+ popt->topt.numericLocale = !popt->topt.numericLocale;
if (!quiet)
{
if (popt->topt.numericLocale)
/* toggle between full and tuples-only format */
else if (strcmp(param, "t") == 0 || strcmp(param, "tuples_only") == 0)
{
- popt->topt.tuples_only = !popt->topt.tuples_only;
+ if (value)
+ popt->topt.tuples_only = ParseVariableBool(value);
+ else
+ popt->topt.tuples_only = !popt->topt.tuples_only;
if (!quiet)
{
if (popt->topt.tuples_only)
{
if (value && pg_strcasecmp(value, "always") == 0)
popt->topt.pager = 2;
+ else if (value)
+ if (ParseVariableBool(value))
+ popt->topt.pager = 1;
+ else
+ popt->topt.pager = 0;
else if (popt->topt.pager == 1)
popt->topt.pager = 0;
else
/* disable "(x rows)" footer */
else if (strcmp(param, "footer") == 0)
{
- popt->default_footer = !popt->default_footer;
+ if (value)
+ popt->default_footer = ParseVariableBool(value);
+ else
+ popt->default_footer = !popt->default_footer;
if (!quiet)
{
if (popt->default_footer)