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
9e292e3e
Commit
9e292e3e
authored
20 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
More fixes for => and ->, use proper ampersand markups.
parent
2d16f7c4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/src/sgml/ref/psql-ref.sgml
+31
-31
31 additions, 31 deletions
doc/src/sgml/ref/psql-ref.sgml
with
31 additions
and
31 deletions
doc/src/sgml/ref/psql-ref.sgml
+
31
−
31
View file @
9e292e3e
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.13
0
2005/01/
14 00:24:23
momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.13
1
2005/01/
22 22:31:52
momjian Exp $
PostgreSQL documentation
-->
...
...
@@ -536,7 +536,7 @@ Type: \copyright for distribution terms
\g or terminate with semicolon to execute query
\q to quit
testdb=
>
testdb=
>
</programlisting>
</para>
...
...
@@ -881,7 +881,7 @@ testdb=>
types, relations (tables, views, indexes, sequences, large
objects), rules, and triggers.) For example:
<programlisting>
=
>
<userinput>\dd version</userinput>
=
>
<userinput>\dd version</userinput>
Object descriptions
Schema | Name | Object | Description
------------+---------+----------+---------------------------
...
...
@@ -1107,7 +1107,7 @@ testdb=>
space and followed by a newline. This can be useful to
intersperse information in the output of scripts. For example:
<programlisting>
=
>
<userinput>\echo `date`</userinput>
=
>
<userinput>\echo `date`</userinput>
Tue Oct 26 21:40:57 CEST 1999
</programlisting>
If the first argument is an unquoted <literal>-n</literal> the trailing
...
...
@@ -1271,7 +1271,7 @@ Tue Oct 26 21:40:57 CEST 1999
large object. Optionally, it associates the given
comment with the object. Example:
<programlisting>
foo=
>
<userinput>\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</userinput>
foo=
>
<userinput>\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</userinput>
lo_import 152801
</programlisting>
The response indicates that the large object received object ID
...
...
@@ -1817,14 +1817,14 @@ lo_import 152801
<application>psql</application> meta-command
<command>\set</command>:
<programlisting>
testdb=
>
<userinput>\set foo bar</userinput>
testdb=
>
<userinput>\set foo bar</userinput>
</programlisting>
sets the variable <literal>foo</literal> to the value
<literal>bar</literal>. To retrieve the content of the variable, precede
the name with a colon and use it as the argument of any slash
command:
<programlisting>
testdb=
>
<userinput>\echo :foo</userinput>
testdb=
>
<userinput>\echo :foo</userinput>
bar
</programlisting>
</para>
...
...
@@ -2154,8 +2154,8 @@ bar
this is again to prepend the variable name with a colon
(<literal>:</literal>).
<programlisting>
testdb=
>
<userinput>\set foo 'my_table'</userinput>
testdb=
>
<userinput>SELECT * FROM :foo;</userinput>
testdb=
>
<userinput>\set foo 'my_table'</userinput>
testdb=
>
<userinput>SELECT * FROM :foo;</userinput>
</programlisting>
would then query the table <literal>my_table</literal>. The value of
the variable is copied literally, so it can even contain unbalanced
...
...
@@ -2171,15 +2171,15 @@ testdb=> <userinput>SELECT * FROM :foo;</userinput>
copy the contents of a file into a table column. First load the file into a
variable and then proceed as above.
<programlisting>
testdb=
>
<userinput>\set content '\'' `cat my_file.txt` '\''</userinput>
testdb=
>
<userinput>INSERT INTO my_table VALUES (:content);</userinput>
testdb=
>
<userinput>\set content '\'' `cat my_file.txt` '\''</userinput>
testdb=
>
<userinput>INSERT INTO my_table VALUES (:content);</userinput>
</programlisting>
One possible problem with this approach is that <filename>my_file.txt</filename>
might contain single quotes. These need to be escaped so that
they don't cause a syntax error when the second line is processed. This
could be done with the program <command>sed</command>:
<programlisting>
testdb=
>
<userinput>\set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\''</userinput>
testdb=
>
<userinput>\set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\''</userinput>
</programlisting>
Observe the correct number of backslashes (6)! It works
this way: After <application>psql</application> has parsed this
...
...
@@ -2384,7 +2384,7 @@ testdb=> <userinput>\set content '\'' `sed -e "s/'/\\\\\\'/g" < my_file.txt` '\'
<literal>%]</literal>. Multiple pairs of these may occur within
the prompt. For example,
<programlisting>
testdb=
>
\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%#%] '
testdb=
>
\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%#%] '
</programlisting>
results in a boldfaced (<literal>1;</literal>) yellow-on-black
(<literal>33;40</literal>) prompt on VT100-compatible, color-capable
...
...
@@ -2569,7 +2569,7 @@ $endif
discouraged. If you get strange messages, keep this in mind.
For example
<programlisting>
testdb=
>
<userinput>\foo</userinput>
testdb=
>
<userinput>\foo</userinput>
Field separator is "oo".
</programlisting>
which is perhaps not what one would expect.
...
...
@@ -2631,15 +2631,15 @@ Field separator is "oo".
The first example shows how to spread a command over several lines of
input. Notice the changing prompt:
<programlisting>
testdb=
>
<userinput>CREATE TABLE my_table (</userinput>
testdb=
>
<userinput>CREATE TABLE my_table (</userinput>
testdb(> <userinput> first integer not null default 0,</userinput>
testdb(> <userinput> second text)</userinput>
testdb-
>
<userinput>;</userinput>
testdb-
>
<userinput>;</userinput>
CREATE TABLE
</programlisting>
Now look at the table definition again:
<programlisting>
testdb=
>
<userinput>\d my_table</userinput>
testdb=
>
<userinput>\d my_table</userinput>
Table "my_table"
Attribute | Type | Modifier
-----------+---------+--------------------
...
...
@@ -2649,13 +2649,13 @@ testdb=> <userinput>\d my_table</userinput>
</programlisting>
Now we change the prompt to something more interesting:
<programlisting>
testdb=
>
<userinput>\set PROMPT1 '%n@%m %~%R%# '</userinput>
peter@localhost testdb=
>
testdb=
>
<userinput>\set PROMPT1 '%n@%m %~%R%# '</userinput>
peter@localhost testdb=
>
</programlisting>
Let's assume you have filled the table with data and want to take a
look at it:
<programlisting>
peter@localhost testdb=
>
SELECT * FROM my_table;
peter@localhost testdb=
>
SELECT * FROM my_table;
first | second
-------+--------
1 | one
...
...
@@ -2668,9 +2668,9 @@ peter@localhost testdb=> SELECT * FROM my_table;
You can display tables in different ways by using the
<command>\pset</command> command:
<programlisting>
peter@localhost testdb=
>
<userinput>\pset border 2</userinput>
peter@localhost testdb=
>
<userinput>\pset border 2</userinput>
Border style is 2.
peter@localhost testdb=
>
<userinput>SELECT * FROM my_table;</userinput>
peter@localhost testdb=
>
<userinput>SELECT * FROM my_table;</userinput>
+-------+--------+
| first | second |
+-------+--------+
...
...
@@ -2681,9 +2681,9 @@ peter@localhost testdb=> <userinput>SELECT * FROM my_table;</userinput>
+-------+--------+
(4 rows)
peter@localhost testdb=
>
<userinput>\pset border 0</userinput>
peter@localhost testdb=
>
<userinput>\pset border 0</userinput>
Border style is 0.
peter@localhost testdb=
>
<userinput>SELECT * FROM my_table;</userinput>
peter@localhost testdb=
>
<userinput>SELECT * FROM my_table;</userinput>
first second
----- ------
1 one
...
...
@@ -2692,15 +2692,15 @@ first second
4 four
(4 rows)
peter@localhost testdb=
>
<userinput>\pset border 1</userinput>
peter@localhost testdb=
>
<userinput>\pset border 1</userinput>
Border style is 1.
peter@localhost testdb=
>
<userinput>\pset format unaligned</userinput>
peter@localhost testdb=
>
<userinput>\pset format unaligned</userinput>
Output format is unaligned.
peter@localhost testdb=
>
<userinput>\pset fieldsep ","</userinput>
peter@localhost testdb=
>
<userinput>\pset fieldsep ","</userinput>
Field separator is ",".
peter@localhost testdb=
>
<userinput>\pset tuples_only</userinput>
peter@localhost testdb=
>
<userinput>\pset tuples_only</userinput>
Showing only tuples.
peter@localhost testdb=
>
<userinput>SELECT second, first FROM my_table;</userinput>
peter@localhost testdb=
>
<userinput>SELECT second, first FROM my_table;</userinput>
one,1
two,2
three,3
...
...
@@ -2708,11 +2708,11 @@ four,4
</programlisting>
Alternatively, use the short commands:
<programlisting>
peter@localhost testdb=
>
<userinput>\a \t \x</userinput>
peter@localhost testdb=
>
<userinput>\a \t \x</userinput>
Output format is aligned.
Tuples only is off.
Expanded display is on.
peter@localhost testdb=
>
<userinput>SELECT * FROM my_table;</userinput>
peter@localhost testdb=
>
<userinput>SELECT * FROM my_table;</userinput>
-[ RECORD 1 ]-
first | 1
second | one
...
...
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