Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
df910a52
Commit
df910a52
authored
18 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Allow \pset and \x, \t to use boolean constants on/off, rather than just
toggle. Chad Wagner
parent
bb8b5b83
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/src/sgml/ref/psql-ref.sgml
+31
-16
31 additions, 16 deletions
doc/src/sgml/ref/psql-ref.sgml
src/bin/psql/command.c
+36
-7
36 additions, 7 deletions
src/bin/psql/command.c
with
67 additions
and
23 deletions
doc/src/sgml/ref/psql-ref.sgml
+
31
−
16
View file @
df910a52
<!--
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.18
7
2007/0
2/23 18:20:58
momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.18
8
2007/0
3/03 17:19:11
momjian Exp $
PostgreSQL documentation
PostgreSQL documentation
-->
-->
...
@@ -1509,11 +1509,14 @@ lo_import 152801
...
@@ -1509,11 +1509,14 @@ lo_import 152801
<term><literal>expanded</literal> (or <literal>x</literal>)</term>
<term><literal>expanded</literal> (or <literal>x</literal>)</term>
<listitem>
<listitem>
<para>
<para>
Toggles between regular and expanded format. When expanded
You can specify an optional second argument, if it is provided it
format is enabled, query results are displayed in two
may be either <literal>on</literal> or <literal>off</literal>
columns, with the column name on the left and the data on
which will enable or disable expanded mode. If the second
the right. This mode is useful if the data wouldn't fit on the
argument is not provided then we will toggle between regular and
screen in the normal <quote>horizontal</quote> mode.
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>
<para>
<para>
...
@@ -1553,8 +1556,11 @@ lo_import 152801
...
@@ -1553,8 +1556,11 @@ lo_import 152801
<term><literal>footer</literal></term>
<term><literal>footer</literal></term>
<listitem>
<listitem>
<para>
<para>
Toggles the display of the default footer <literal>(x
You can specify an optional second argument, if it is provided it
rows)</literal>.
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>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -1563,9 +1569,12 @@ lo_import 152801
...
@@ -1563,9 +1569,12 @@ lo_import 152801
<term><literal>numericlocale</literal></term>
<term><literal>numericlocale</literal></term>
<listitem>
<listitem>
<para>
<para>
Toggles the display of a locale-aware character to separate groups
You can specify an optional second argument, if it is provided it
of digits to the left of the decimal marker. It also enables
may be either <literal>on</literal> or <literal>off</literal>
a locale-aware decimal marker.
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>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -1584,10 +1593,13 @@ lo_import 152801
...
@@ -1584,10 +1593,13 @@ lo_import 152801
<term><literal>tuples_only</literal> (or <literal>t</literal>)</term>
<term><literal>tuples_only</literal> (or <literal>t</literal>)</term>
<listitem>
<listitem>
<para>
<para>
Toggles between tuples only and full display. Full display
You can specify an optional second argument, if it is provided it
shows extra information such as column headers, titles, and
may be either <literal>on</literal> or <literal>off</literal>
various footers. In tuples only mode, only actual table data
which will enable or display the tuples only mode. If the
is shown.
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>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
@@ -1636,7 +1648,10 @@ lo_import 152801
...
@@ -1636,7 +1648,10 @@ lo_import 152801
(<application>psql</> does not do a perfect job of estimating
(<application>psql</> does not do a perfect job of estimating
when to use the pager.) <literal>\pset pager</> turns the
when to use the pager.) <literal>\pset pager</> turns the
pager on and off. Pager can also be set to <literal>always</>,
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>
</para>
</listitem>
</listitem>
</varlistentry>
</varlistentry>
...
...
This diff is collapsed.
Click to expand it.
src/bin/psql/command.c
+
36
−
7
View file @
df910a52
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
*
*
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
* Copyright (c) 2000-2007, PostgreSQL Global Development Group
*
*
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.17
8
2007/0
2/23 18:20:58
momjian Exp $
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.17
9
2007/0
3/03 17:19:11
momjian Exp $
*/
*/
#include
"postgres_fe.h"
#include
"postgres_fe.h"
#include
"command.h"
#include
"command.h"
...
@@ -863,7 +863,13 @@ exec_command(const char *cmd,
...
@@ -863,7 +863,13 @@ exec_command(const char *cmd,
/* \t -- turn off headers and row count */
/* \t -- turn off headers and row count */
else
if
(
strcmp
(
cmd
,
"t"
)
==
0
)
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 */
/* \T -- define html <table ...> attributes */
...
@@ -975,7 +981,13 @@ exec_command(const char *cmd,
...
@@ -975,7 +981,13 @@ exec_command(const char *cmd,
/* \x -- toggle expanded table representation */
/* \x -- toggle expanded table representation */
else
if
(
strcmp
(
cmd
,
"x"
)
==
0
)
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) */
/* \z -- list table rights (equivalent to \dp) */
else
if
(
strcmp
(
cmd
,
"z"
)
==
0
)
else
if
(
strcmp
(
cmd
,
"z"
)
==
0
)
...
@@ -1552,7 +1564,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
...
@@ -1552,7 +1564,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
/* set expanded/vertical mode */
/* set expanded/vertical mode */
else
if
(
strcmp
(
param
,
"x"
)
==
0
||
strcmp
(
param
,
"expanded"
)
==
0
||
strcmp
(
param
,
"vertical"
)
==
0
)
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
)
if
(
!
quiet
)
printf
(
popt
->
topt
.
expanded
printf
(
popt
->
topt
.
expanded
?
_
(
"Expanded display is on.
\n
"
)
?
_
(
"Expanded display is on.
\n
"
)
...
@@ -1562,7 +1577,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
...
@@ -1562,7 +1577,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
/* locale-aware numeric output */
/* locale-aware numeric output */
else
if
(
strcmp
(
param
,
"numericlocale"
)
==
0
)
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
(
!
quiet
)
{
{
if
(
popt
->
topt
.
numericLocale
)
if
(
popt
->
topt
.
numericLocale
)
...
@@ -1616,7 +1634,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
...
@@ -1616,7 +1634,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
/* toggle between full and tuples-only format */
/* toggle between full and tuples-only format */
else
if
(
strcmp
(
param
,
"t"
)
==
0
||
strcmp
(
param
,
"tuples_only"
)
==
0
)
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
(
!
quiet
)
{
{
if
(
popt
->
topt
.
tuples_only
)
if
(
popt
->
topt
.
tuples_only
)
...
@@ -1667,6 +1688,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
...
@@ -1667,6 +1688,11 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
{
{
if
(
value
&&
pg_strcasecmp
(
value
,
"always"
)
==
0
)
if
(
value
&&
pg_strcasecmp
(
value
,
"always"
)
==
0
)
popt
->
topt
.
pager
=
2
;
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
)
else
if
(
popt
->
topt
.
pager
==
1
)
popt
->
topt
.
pager
=
0
;
popt
->
topt
.
pager
=
0
;
else
else
...
@@ -1685,7 +1711,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
...
@@ -1685,7 +1711,10 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet)
/* disable "(x rows)" footer */
/* disable "(x rows)" footer */
else
if
(
strcmp
(
param
,
"footer"
)
==
0
)
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
(
!
quiet
)
{
{
if
(
popt
->
default_footer
)
if
(
popt
->
default_footer
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment