mirror of
https://github.com/postgres/postgres.git
synced 2025-12-19 17:02:53 +03:00
Consistenly use colons before '<programlisting>' blocks, where
appropriate.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.93 2007/01/31 23:26:02 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.94 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -636,7 +636,7 @@ where <replaceable class="PARAMETER">action</replaceable> is one of:
|
||||
The fact that <literal>ALTER TYPE</> requires rewriting the whole table
|
||||
is sometimes an advantage, because the rewriting process eliminates
|
||||
any dead space in the table. For example, to reclaim the space occupied
|
||||
by a dropped column immediately, the fastest way is
|
||||
by a dropped column immediately, the fastest way is:
|
||||
<programlisting>
|
||||
ALTER TABLE table ALTER COLUMN anycol TYPE anytype;
|
||||
</programlisting>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/cluster.sgml,v 1.39 2007/01/31 23:26:02 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/cluster.sgml,v 1.40 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -144,7 +144,7 @@ CLUSTER
|
||||
entries are on random pages, so there is one disk page
|
||||
retrieved for every row moved. (<productname>PostgreSQL</productname> has
|
||||
a cache, but the majority of a big table will not fit in the cache.)
|
||||
The other way to cluster a table is to use
|
||||
The other way to cluster a table is to use:
|
||||
|
||||
<programlisting>
|
||||
CREATE TABLE <replaceable class="parameter">newtable</replaceable> AS
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.37 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_aggregate.sgml,v 1.38 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -145,11 +145,11 @@ CREATE AGGREGATE <replaceable class="PARAMETER">name</replaceable> (
|
||||
input row. If this aggregate can be so optimized, indicate it by
|
||||
specifying a <firstterm>sort operator</>. The basic requirement is that
|
||||
the aggregate must yield the first element in the sort ordering induced by
|
||||
the operator; in other words
|
||||
the operator; in other words:
|
||||
<programlisting>
|
||||
SELECT agg(col) FROM tab;
|
||||
</programlisting>
|
||||
must be equivalent to
|
||||
must be equivalent to:
|
||||
<programlisting>
|
||||
SELECT col FROM tab ORDER BY col USING sortop LIMIT 1;
|
||||
</programlisting>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.24 2007/01/31 23:26:03 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.25 2007/02/01 00:28:18 momjian Exp $ -->
|
||||
|
||||
<refentry id="SQL-CREATECAST">
|
||||
<refmeta>
|
||||
@@ -33,7 +33,7 @@ CREATE CAST (<replaceable>sourcetype</replaceable> AS <replaceable>targettype</r
|
||||
<para>
|
||||
<command>CREATE CAST</command> defines a new cast. A cast
|
||||
specifies how to perform a conversion between
|
||||
two data types. For example,
|
||||
two data types. For example:
|
||||
<programlisting>
|
||||
SELECT CAST(42 AS text);
|
||||
</programlisting>
|
||||
@@ -64,7 +64,7 @@ SELECT CAST(42 AS text);
|
||||
If the cast is marked <literal>AS ASSIGNMENT</> then it can be invoked
|
||||
implicitly when assigning a value to a column of the target data type.
|
||||
For example, supposing that <literal>foo.f1</literal> is a column of
|
||||
type <type>text</type>, then
|
||||
type <type>text</type>, then:
|
||||
<programlisting>
|
||||
INSERT INTO foo (f1) VALUES (42);
|
||||
</programlisting>
|
||||
@@ -85,7 +85,7 @@ SELECT 'The time is ' || now();
|
||||
</programlisting>
|
||||
will be allowed only if the cast from type <type>timestamp</> to
|
||||
<type>text</type> is marked <literal>AS IMPLICIT</>. Otherwise it
|
||||
will be necessary to write the cast explicitly, for example
|
||||
will be necessary to write the cast explicitly, for example:
|
||||
<programlisting>
|
||||
SELECT 'The time is ' || CAST(now() AS text);
|
||||
</programlisting>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.30 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.31 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -166,7 +166,7 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
|
||||
<para>
|
||||
This example creates the <type>us_postal_code</type> data type and
|
||||
then uses the type in a table definition. A regular expression test
|
||||
is used to verify that the value looks like a valid US postal code.
|
||||
is used to verify that the value looks like a valid US postal code:
|
||||
|
||||
<programlisting>
|
||||
CREATE DOMAIN us_postal_code AS TEXT
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.47 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_operator.sgml,v 1.48 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -205,7 +205,7 @@ CREATE OPERATOR <replaceable>name</replaceable> (
|
||||
<para>
|
||||
To give a schema-qualified operator name in <replaceable
|
||||
class="parameter">com_op</replaceable> or the other optional
|
||||
arguments, use the <literal>OPERATOR()</> syntax, for example
|
||||
arguments, use the <literal>OPERATOR()</> syntax, for example:
|
||||
<programlisting>
|
||||
COMMUTATOR = OPERATOR(myschema.===) ,
|
||||
</programlisting>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.49 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.50 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -248,7 +248,7 @@ SELECT * FROM t1;
|
||||
command, the <command>NOTIFY</command> command will be executed
|
||||
unconditionally, that is, the <command>NOTIFY</command> will be
|
||||
issued even if there are not any rows that the rule should apply
|
||||
to. For example, in
|
||||
to. For example, in:
|
||||
<programlisting>
|
||||
CREATE RULE notify_me AS ON UPDATE TO mytable DO ALSO NOTIFY mytable;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.46 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_sequence.sgml,v 1.47 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -57,7 +57,7 @@ CREATE [ TEMPORARY | TEMP ] SEQUENCE <replaceable class="parameter">name</replac
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Although you cannot update a sequence directly, you can use a query like
|
||||
Although you cannot update a sequence directly, you can use a query like:
|
||||
|
||||
<programlisting>
|
||||
SELECT * FROM <replaceable>name</replaceable>;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.106 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.107 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -792,7 +792,7 @@ CREATE TABLE array_int (
|
||||
<para>
|
||||
Define a unique table constraint for the table
|
||||
<literal>films</literal>. Unique table constraints can be defined
|
||||
on one or more columns of the table.
|
||||
on one or more columns of the table:
|
||||
|
||||
<programlisting>
|
||||
CREATE TABLE films (
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.67 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_type.sgml,v 1.68 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -591,7 +591,7 @@ CREATE TABLE myboxes (
|
||||
|
||||
<para>
|
||||
If the internal structure of <type>box</type> were an array of four
|
||||
<type>float4</> elements, we might instead use
|
||||
<type>float4</> elements, we might instead use:
|
||||
<programlisting>
|
||||
CREATE TYPE box (
|
||||
INTERNALLENGTH = 16,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_view.sgml,v 1.34 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/create_view.sgml,v 1.35 2007/02/01 00:28:18 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -126,13 +126,13 @@ CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] VIEW <replaceable class="PARAMETER">n
|
||||
|
||||
<para>
|
||||
Be careful that the names and types of the view's columns will be
|
||||
assigned the way you want. For example,
|
||||
assigned the way you want. For example:
|
||||
<programlisting>
|
||||
CREATE VIEW vista AS SELECT 'Hello World';
|
||||
</programlisting>
|
||||
is bad form in two ways: the column name defaults to <literal>?column?</>,
|
||||
and the column data type defaults to <type>unknown</>. If you want a
|
||||
string literal in a view's result, use something like
|
||||
string literal in a view's result, use something like:
|
||||
<programlisting>
|
||||
CREATE VIEW vista AS SELECT text 'Hello World' AS hello;
|
||||
</programlisting>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/delete.sgml,v 1.29 2007/01/31 23:26:03 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/delete.sgml,v 1.30 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -197,7 +197,7 @@ DELETE <replaceable class="parameter">count</replaceable>
|
||||
<productname>PostgreSQL</productname> lets you reference columns of
|
||||
other tables in the <literal>WHERE</> condition by specifying the
|
||||
other tables in the <literal>USING</literal> clause. For example,
|
||||
to delete all films produced by a given producer, one can do
|
||||
to delete all films produced by a given producer, one can do:
|
||||
<programlisting>
|
||||
DELETE FROM films USING producers
|
||||
WHERE producer_id = producers.id AND producers.name = 'foo';
|
||||
@@ -205,7 +205,7 @@ DELETE FROM films USING producers
|
||||
What is essentially happening here is a join between <structname>films</>
|
||||
and <structname>producers</>, with all successfully joined
|
||||
<structname>films</> rows being marked for deletion.
|
||||
This syntax is not standard. A more standard way to do it is
|
||||
This syntax is not standard. A more standard way to do it is:
|
||||
<programlisting>
|
||||
DELETE FROM films
|
||||
WHERE producer_id IN (SELECT id FROM producers WHERE name = 'foo');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/fetch.sgml,v 1.39 2006/09/16 00:30:18 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/fetch.sgml,v 1.40 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -343,7 +343,7 @@ FETCH <replaceable class="parameter">count</replaceable>
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
The following example traverses a table using a cursor.
|
||||
The following example traverses a table using a cursor:
|
||||
|
||||
<programlisting>
|
||||
BEGIN WORK;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.63 2007/01/31 23:26:04 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/grant.sgml,v 1.64 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -436,7 +436,7 @@ GRANT <replaceable class="PARAMETER">role</replaceable> [, ...] TO <replaceable
|
||||
</programlisting>
|
||||
|
||||
The above example display would be seen by user <literal>miriam</> after
|
||||
creating table <literal>mytable</> and doing
|
||||
creating table <literal>mytable</> and doing:
|
||||
|
||||
<programlisting>
|
||||
GRANT SELECT ON mytable TO PUBLIC;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.65 2007/01/31 23:26:04 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.66 2007/02/01 00:28:19 momjian Exp $ -->
|
||||
|
||||
<refentry id="APP-PGRESTORE">
|
||||
<refmeta>
|
||||
@@ -623,7 +623,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>pg_restore -l db.dump > db.list</userinput>
|
||||
</screen>
|
||||
The listing file consists of a header and one line for each item, e.g.,
|
||||
The listing file consists of a header and one line for each item, e.g.:
|
||||
<programlisting>
|
||||
;
|
||||
; Archive created at Fri Jul 28 22:28:36 2000
|
||||
@@ -654,7 +654,7 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Lines in the file can be commented out, deleted, and reordered. For example,
|
||||
Lines in the file can be commented out, deleted, and reordered. For example:
|
||||
<programlisting>
|
||||
10; 145433 TABLE map_resolutions postgres
|
||||
;2; 145344 TABLE species postgres
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.181 2007/01/31 23:26:04 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.182 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -563,7 +563,7 @@ PostgreSQL documentation
|
||||
An alternative way to specify connection parameters is in a
|
||||
<parameter>conninfo</parameter> string, which is used instead of a
|
||||
database name. This mechanism give you very wide control over the
|
||||
connection. For example,
|
||||
connection. For example:
|
||||
<programlisting>
|
||||
$ <userinput>psql "service=myservice sslmode=require"</userinput>
|
||||
</programlisting>
|
||||
@@ -585,7 +585,7 @@ $ <userinput>psql "service=myservice sslmode=require"</userinput>
|
||||
In normal operation, <application>psql</application> provides a
|
||||
prompt with the name of the database to which
|
||||
<application>psql</application> is currently connected, followed by
|
||||
the string <literal>=></literal>. For example,
|
||||
the string <literal>=></literal>. For example:
|
||||
<programlisting>
|
||||
$ <userinput>psql testdb</userinput>
|
||||
Welcome to psql &version;, the PostgreSQL interactive terminal.
|
||||
@@ -2134,7 +2134,7 @@ bar
|
||||
<listitem>
|
||||
<para>
|
||||
The file name that will be used to store the history list. The default
|
||||
value is <filename>~/.psql_history</filename>. For example, putting
|
||||
value is <filename>~/.psql_history</filename>. For example, putting:
|
||||
<programlisting>
|
||||
\set HISTFILE ~/.psql_history- :DBNAME
|
||||
</programlisting>
|
||||
@@ -2344,7 +2344,7 @@ bar
|
||||
variables is that you can substitute (<quote>interpolate</quote>)
|
||||
them into regular <acronym>SQL</acronym> statements. The syntax for
|
||||
this is again to prepend the variable name with a colon
|
||||
(<literal>:</literal>).
|
||||
(<literal>:</literal>):
|
||||
<programlisting>
|
||||
testdb=> <userinput>\set foo 'my_table'</userinput>
|
||||
testdb=> <userinput>SELECT * FROM :foo;</userinput>
|
||||
@@ -2361,7 +2361,7 @@ testdb=> <userinput>SELECT * FROM :foo;</userinput>
|
||||
inserted <acronym>OID</acronym> in subsequent statements to build a
|
||||
foreign key scenario. Another possible use of this mechanism is to
|
||||
copy the contents of a file into a table column. First load the file into a
|
||||
variable and then proceed as above.
|
||||
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>
|
||||
@@ -2566,7 +2566,7 @@ testdb=> <userinput>\set content '''' `sed -e "s/'/''/g" -e 's/\\/\\\\/g' <
|
||||
non-printing control characters must be designated as invisible
|
||||
by surrounding them with <literal>%[</literal> and
|
||||
<literal>%]</literal>. Multiple pairs of these can occur within
|
||||
the prompt. For example,
|
||||
the prompt. For example:
|
||||
<programlisting>
|
||||
testdb=> \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '
|
||||
</programlisting>
|
||||
@@ -2759,7 +2759,7 @@ $endif
|
||||
compatibility this is still supported to some extent,
|
||||
but we are not going to explain the details here as this use is
|
||||
discouraged. If you get strange messages, keep this in mind.
|
||||
For example
|
||||
For example:
|
||||
<programlisting>
|
||||
testdb=> <userinput>\foo</userinput>
|
||||
Field separator is "oo".
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.97 2007/01/31 23:26:04 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/select.sgml,v 1.98 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -749,7 +749,7 @@ SELECT name FROM distributors ORDER BY code;
|
||||
<literal>ORDER BY</> (see above). Note that the <quote>first
|
||||
row</quote> of each set is unpredictable unless <literal>ORDER
|
||||
BY</> is used to ensure that the desired row appears first. For
|
||||
example,
|
||||
example:
|
||||
<programlisting>
|
||||
SELECT DISTINCT ON (location) location, time, report
|
||||
FROM weather_reports
|
||||
@@ -900,7 +900,7 @@ FOR SHARE [ OF <replaceable class="parameter">table_name</replaceable> [, ...] ]
|
||||
<para>
|
||||
Avoid locking a row and then modifying it within a later savepoint or
|
||||
<application>PL/pgSQL</application> exception block. A subsequent
|
||||
rollback would cause the lock to be lost. For example,
|
||||
rollback would cause the lock to be lost. For example:
|
||||
<programlisting>
|
||||
BEGIN;
|
||||
SELECT * FROM mytable WHERE key = 1 FOR UPDATE;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/update.sgml,v 1.42 2007/01/31 23:26:04 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/update.sgml,v 1.43 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -295,7 +295,7 @@ UPDATE employees SET sales_count = sales_count + 1 WHERE id =
|
||||
<para>
|
||||
Attempt to insert a new stock item along with the quantity of stock. If
|
||||
the item already exists, instead update the stock count of the existing
|
||||
item. To do this without failing the entire transaction, use savepoints.
|
||||
item. To do this without failing the entire transaction, use savepoints:
|
||||
<programlisting>
|
||||
BEGIN;
|
||||
-- other operations
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/values.sgml,v 1.3 2007/01/31 23:26:05 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/values.sgml,v 1.4 2007/02/01 00:28:19 momjian Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@@ -143,7 +143,7 @@ VALUES (1, 'one'), (2, 'two'), (3, 'three');
|
||||
</programlisting>
|
||||
|
||||
This will return a table of two columns and three rows. It's effectively
|
||||
equivalent to
|
||||
equivalent to:
|
||||
|
||||
<programlisting>
|
||||
SELECT 1 AS column1, 'one' AS column2
|
||||
|
||||
Reference in New Issue
Block a user