3
3
*
4
4
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
5
5
*
6
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.178 2007/02/23 18:20:58 momjian Exp $
6
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.179 2007/03/03 17:19:11 momjian Exp $
7
7
*/
8
8
#include "postgres_fe.h"
9
9
#include "command.h"
@@ -863,7 +863,13 @@ exec_command(const char *cmd,
863
863
864
864
/* \t -- turn off headers and row count */
865
865
else if (strcmp (cmd , "t" ) == 0 )
866
- success = do_pset ("tuples_only" , NULL , & pset .popt , pset .quiet );
866
+ {
867
+ char * opt = psql_scan_slash_option (scan_state ,
868
+ OT_NORMAL , NULL , true);
869
+
870
+ success = do_pset ("tuples_only" , opt , & pset .popt , pset .quiet );
871
+ free (opt );
872
+ }
867
873
868
874
869
875
/* \T -- define html <table ...> attributes */
@@ -975,7 +981,13 @@ exec_command(const char *cmd,
975
981
976
982
/* \x -- toggle expanded table representation */
977
983
else if (strcmp (cmd , "x" ) == 0 )
978
- success = do_pset ("expanded" , NULL , & pset .popt , pset .quiet );
984
+ {
985
+ char * opt = psql_scan_slash_option (scan_state ,
986
+ OT_NORMAL , NULL , true);
987
+
988
+ success = do_pset ("expanded" , opt , & pset .popt , pset .quiet );
989
+ free (opt );
990
+ }
979
991
980
992
/* \z -- list table rights (equivalent to \dp) */
981
993
else if (strcmp (cmd , "z" ) == 0 )
@@ -1552,7 +1564,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
1552
1564
/* set expanded/vertical mode */
1553
1565
else if (strcmp (param , "x" ) == 0 || strcmp (param , "expanded" ) == 0 || strcmp (param , "vertical" ) == 0 )
1554
1566
{
1555
- popt -> topt .expanded = !popt -> topt .expanded ;
1567
+ if (value )
1568
+ popt -> topt .expanded = ParseVariableBool (value );
1569
+ else
1570
+ popt -> topt .expanded = !popt -> topt .expanded ;
1556
1571
if (!quiet )
1557
1572
printf (popt -> topt .expanded
1558
1573
? _ ("Expanded display is on.\n" )
@@ -1562,7 +1577,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
1562
1577
/* locale-aware numeric output */
1563
1578
else if (strcmp (param , "numericlocale" ) == 0 )
1564
1579
{
1565
- popt -> topt .numericLocale = !popt -> topt .numericLocale ;
1580
+ if (value )
1581
+ popt -> topt .numericLocale = ParseVariableBool (value );
1582
+ else
1583
+ popt -> topt .numericLocale = !popt -> topt .numericLocale ;
1566
1584
if (!quiet )
1567
1585
{
1568
1586
if (popt -> topt .numericLocale )
@@ -1616,7 +1634,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
1616
1634
/* toggle between full and tuples-only format */
1617
1635
else if (strcmp (param , "t" ) == 0 || strcmp (param , "tuples_only" ) == 0 )
1618
1636
{
1619
- popt -> topt .tuples_only = !popt -> topt .tuples_only ;
1637
+ if (value )
1638
+ popt -> topt .tuples_only = ParseVariableBool (value );
1639
+ else
1640
+ popt -> topt .tuples_only = !popt -> topt .tuples_only ;
1620
1641
if (!quiet )
1621
1642
{
1622
1643
if (popt -> topt .tuples_only )
@@ -1667,6 +1688,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
1667
1688
{
1668
1689
if (value && pg_strcasecmp (value , "always" ) == 0 )
1669
1690
popt -> topt .pager = 2 ;
1691
+ else if (value )
1692
+ if (ParseVariableBool (value ))
1693
+ popt -> topt .pager = 1 ;
1694
+ else
1695
+ popt -> topt .pager = 0 ;
1670
1696
else if (popt -> topt .pager == 1 )
1671
1697
popt -> topt .pager = 0 ;
1672
1698
else
@@ -1685,7 +1711,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
1685
1711
/* disable "(x rows)" footer */
1686
1712
else if (strcmp (param , "footer" ) == 0 )
1687
1713
{
1688
- popt -> default_footer = !popt -> default_footer ;
1714
+ if (value )
1715
+ popt -> default_footer = ParseVariableBool (value );
1716
+ else
1717
+ popt -> default_footer = !popt -> default_footer ;
1689
1718
if (!quiet )
1690
1719
{
1691
1720
if (popt -> default_footer )
0 commit comments