Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
ffb120ec
Commit
ffb120ec
authored
Aug 10, 1998
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new \w write command to psql.
parent
5e490118
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
39 deletions
+66
-39
src/bin/psql/psql.c
src/bin/psql/psql.c
+61
-37
src/man/psql.1
src/man/psql.1
+4
-1
src/tools/backend/index.html
src/tools/backend/index.html
+1
-1
No files found.
src/bin/psql/psql.c
View file @
ffb120ec
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.15
2 1998/08/06 05:12:55
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.15
3 1998/08/10 20:31:38
momjian Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -254,6 +254,7 @@ slashUsage(PsqlSettings *pset)
fprintf
(
fout
,
"
\\
t -- toggle table headings and row count (currently %s)
\n
"
,
on
(
pset
->
opt
.
header
));
fprintf
(
fout
,
"
\\
T [<html>] -- set html3.0 <table ...> options (currently '%s')
\n
"
,
pset
->
opt
.
tableOpt
?
pset
->
opt
.
tableOpt
:
""
);
fprintf
(
fout
,
"
\\
x -- toggle expanded output (currently %s)
\n
"
,
on
(
pset
->
opt
.
expanded
));
fprintf
(
fout
,
"
\\
w <fname> -- output current buffer to a file
\n
"
);
fprintf
(
fout
,
"
\\
z -- list current grant/revoke permissions
\n
"
);
fprintf
(
fout
,
"
\\
! [<cmd>] -- shell escape or command
\n
"
);
...
...
@@ -2135,13 +2136,34 @@ HandleSlashCmds(PsqlSettings *pset,
break
;
}
case
'H'
:
if
(
toggle
(
pset
,
&
pset
->
opt
.
html3
,
"HTML3.0 tabular output"
))
pset
->
opt
.
standard
=
0
;
break
;
case
'l'
:
/* \l is list database */
listAllDbs
(
pset
);
break
;
case
'H'
:
if
(
toggle
(
pset
,
&
pset
->
opt
.
html3
,
"HTML3.0 tabular output"
))
pset
->
opt
.
standard
=
0
;
case
'm'
:
/* monitor like type-setting */
if
(
toggle
(
pset
,
&
pset
->
opt
.
standard
,
"standard SQL separaters and padding"
))
{
pset
->
opt
.
html3
=
pset
->
opt
.
expanded
=
0
;
pset
->
opt
.
align
=
pset
->
opt
.
header
=
1
;
if
(
pset
->
opt
.
fieldSep
)
free
(
pset
->
opt
.
fieldSep
);
pset
->
opt
.
fieldSep
=
strdup
(
"|"
);
if
(
!
pset
->
quiet
)
printf
(
"field separator changed to '%s'
\n
"
,
pset
->
opt
.
fieldSep
);
}
else
{
if
(
pset
->
opt
.
fieldSep
)
free
(
pset
->
opt
.
fieldSep
);
pset
->
opt
.
fieldSep
=
strdup
(
DEFAULT_FIELD_SEP
);
if
(
!
pset
->
quiet
)
printf
(
"field separator changed to '%s'
\n
"
,
pset
->
opt
.
fieldSep
);
}
break
;
case
'o'
:
...
...
@@ -2175,31 +2197,6 @@ HandleSlashCmds(PsqlSettings *pset,
#endif
break
;
case
'm'
:
/* monitor like type-setting */
if
(
toggle
(
pset
,
&
pset
->
opt
.
standard
,
"standard SQL separaters and padding"
))
{
pset
->
opt
.
html3
=
pset
->
opt
.
expanded
=
0
;
pset
->
opt
.
align
=
pset
->
opt
.
header
=
1
;
if
(
pset
->
opt
.
fieldSep
)
free
(
pset
->
opt
.
fieldSep
);
pset
->
opt
.
fieldSep
=
strdup
(
"|"
);
if
(
!
pset
->
quiet
)
printf
(
"field separator changed to '%s'
\n
"
,
pset
->
opt
.
fieldSep
);
}
else
{
if
(
pset
->
opt
.
fieldSep
)
free
(
pset
->
opt
.
fieldSep
);
pset
->
opt
.
fieldSep
=
strdup
(
DEFAULT_FIELD_SEP
);
if
(
!
pset
->
quiet
)
printf
(
"field separator changed to '%s'
\n
"
,
pset
->
opt
.
fieldSep
);
}
break
;
case
'z'
:
/* list table rights (grant/revoke) */
rightsList
(
pset
);
break
;
case
't'
:
/* toggle headers */
toggle
(
pset
,
&
pset
->
opt
.
header
,
"output headings and row count"
);
break
;
...
...
@@ -2216,10 +2213,34 @@ HandleSlashCmds(PsqlSettings *pset,
}
break
;
case
'w'
:
{
FILE
*
fd
;
if
(
!
optarg
)
{
fprintf
(
stderr
,
"
\\
w must be followed by a file name
\n
"
);
break
;
}
if
((
fd
=
fopen
(
optarg
,
"w"
))
==
NULL
)
{
fprintf
(
stderr
,
"file named %s could not be opened
\n
"
,
optarg
);
break
;
}
fputs
(
query
,
fd
);
fputs
(
"
\n
"
,
fd
);
fclose
(
fd
);
break
;
}
case
'x'
:
toggle
(
pset
,
&
pset
->
opt
.
expanded
,
"expanded table representation"
);
break
;
case
'z'
:
/* list table rights (grant/revoke) */
rightsList
(
pset
);
break
;
case
'!'
:
do_shell
(
optarg
);
break
;
...
...
@@ -2252,13 +2273,17 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
int
successResult
=
1
;
int
slashCmdStatus
=
CMD_SEND
;
/*
* slashCmdStatus can be: CMD_UNKNOWN - send currently constructed
* query to backend (i.e. we got a \g) CMD_SEND - send
* currently constructed query to backend (i.e. we got a \g)
* CMD_SKIP_LINE - skip processing of this line, continue building
* up query CMD_TERMINATE - terminate processing of this query
* entirely CMD_NEWEDIT - new query supplied by edit
/*--------------------------------------------------------------
* slashCmdStatus can be:
* CMD_UNKNOWN - send currently constructed query to backend
* (i.e. we got a \g)
* CMD_SEND - send currently constructed query to backend
* (i.e. we got a \g)
* CMD_SKIP_LINE - skip processing of this line, continue building
* up query
* CMD_TERMINATE - terminate processing of this query entirely
* CMD_NEWEDIT - new query supplied by edit
*---------------------------------------------------------------
*/
bool
querySent
=
false
;
...
...
@@ -2358,7 +2383,6 @@ MainLoop(PsqlSettings *pset, char *query, FILE *source)
* query - pointer to current command query_start - placeholder
* for next command
*/
if
(
line
==
NULL
||
(
!
interactive
&&
*
line
==
'\0'
))
{
/* No more input. Time to quit, or \i
* done */
...
...
src/man/psql.1
View file @
ffb120ec
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.2
7 1998/08/03 05:54:3
0 momjian Exp $
.\" $Header: /cvsroot/pgsql/src/man/Attic/psql.1,v 1.2
8 1998/08/10 20:31:4
0 momjian Exp $
.TH PSQL UNIX 1/20/96 PostgreSQL PostgreSQL
.SH NAME
psql - run the interactive query front-end
...
...
@@ -380,6 +380,9 @@ Toggles extended row format mode. When enabled each row will have its column
names printed on the left with the column values printed on the right.
This is useful for rows which are otherwise too long to fit into
one screen line. HTML row output mode supports this flag too.
.IP "\ew [\fIfilename\fR]"
Outputs current query buffer to
.IR filename .
.IP "\ez"
Produces a list of all tables in database with their appropriate ACLs
(grant/revoke permissions) listed.
...
...
src/tools/backend/index.html
View file @
ffb120ec
...
...
@@ -162,7 +162,7 @@ HREF="../../backend/storage/ipc/shmem.c">ShmemInitHash().</A><P>
<ADDRESS>
Maintainer: Bruce Momjian (
<A
HREF=
"mailto:maillist@candle.pha.pa.us"
>
maillist@candle.pha.pa.us
</A>
)
<BR>
Last updated:
Tue Dec 9 17:56:08 EST 1997
Last updated:
Mon Aug 10 10:48:06 EDT 1998
</ADDRESS>
</SMALL>
</BODY>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment