Minor copy-editing.

This commit is contained in:
Tom Lane 2003-08-14 23:13:27 +00:00
parent b72c1b9f63
commit 0684043e39
4 changed files with 42 additions and 39 deletions

View File

@ -1,4 +1,4 @@
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.16 2003/08/10 01:20:34 tgl Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ddl.sgml,v 1.17 2003/08/14 23:13:27 tgl Exp $ -->
<chapter id="ddl"> <chapter id="ddl">
<title>Data Definition</title> <title>Data Definition</title>
@ -490,7 +490,7 @@ CREATE TABLE products (
price numeric NOT NULL CHECK (price > 0) price numeric NOT NULL CHECK (price > 0)
); );
</programlisting> </programlisting>
The order doesn't matter. It does not necessarily affect in which The order doesn't matter. It does not necessarily determine in which
order the constraints are checked. order the constraints are checked.
</para> </para>
@ -578,7 +578,7 @@ CREATE TABLE products (
least) two rows in the table where the values of each of the least) two rows in the table where the values of each of the
corresponding columns that are part of the constraint are equal. corresponding columns that are part of the constraint are equal.
However, null values are not considered equal in this However, null values are not considered equal in this
consideration. That means, in the presence of a multicolumn consideration. That means even in the presence of a
unique constraint it is possible to store an unlimited number of unique constraint it is possible to store an unlimited number of
rows that contain a null value in at least one of the constrained rows that contain a null value in at least one of the constrained
columns. This behavior conforms to the SQL standard, but we have columns. This behavior conforms to the SQL standard, but we have
@ -629,7 +629,7 @@ CREATE TABLE example (
A primary key indicates that a column or group of columns can be A primary key indicates that a column or group of columns can be
used as a unique identifier for rows in the table. (This is a used as a unique identifier for rows in the table. (This is a
direct consequence of the definition of a primary key. Note that direct consequence of the definition of a primary key. Note that
a unique constraint does not, in fact, provide a unique identifier a unique constraint does not, by itself, provide a unique identifier
because it does not exclude null values.) This is useful both for because it does not exclude null values.) This is useful both for
documentation purposes and for client applications. For example, documentation purposes and for client applications. For example,
a GUI application that allows modifying row values probably needs a GUI application that allows modifying row values probably needs
@ -850,8 +850,9 @@ CREATE TABLE capitals (
In this case, a row of capitals <firstterm>inherits</firstterm> all In this case, a row of capitals <firstterm>inherits</firstterm> all
attributes (name, population, and altitude) from its attributes (name, population, and altitude) from its
parent, cities. The type of the attribute name is parent, cities. The type of the attribute name is
<type>text</type>, a native <productname>PostgreSQL</productname> type for variable length <type>text</type>, a native <productname>PostgreSQL</productname> type
ASCII strings. The type of the attribute population is for variable length character strings. The type of the attribute
population is
<type>float</type>, a native <productname>PostgreSQL</productname> type for double precision <type>float</type>, a native <productname>PostgreSQL</productname> type for double precision
floating-point numbers. State capitals have an extra floating-point numbers. State capitals have an extra
attribute, state, that shows their state. In <productname>PostgreSQL</productname>, attribute, state, that shows their state. In <productname>PostgreSQL</productname>,
@ -964,7 +965,7 @@ WHERE c.altitude &gt; 500 and c.tableoid = p.oid;
<para> <para>
In previous versions of <productname>PostgreSQL</productname>, the In previous versions of <productname>PostgreSQL</productname>, the
default was not to get access to child tables. This was found to default was not to get access to child tables. This was found to
be error prone and is also in violation of the SQL standard. Under the old be error prone and is also in violation of the SQL99 standard. Under the old
syntax, to get the sub-tables you append <literal>*</literal> to the table name. syntax, to get the sub-tables you append <literal>*</literal> to the table name.
For example For example
<programlisting> <programlisting>
@ -1180,7 +1181,8 @@ ALTER TABLE products RENAME TO items;
<note> <note>
<para> <para>
To change the owner of a table, index, sequence, or view, use the To change the owner of a table, index, sequence, or view, use the
<command>ALTER TABLE</command> command. <xref linkend="sql-altertable" endterm="sql-altertable-title">
command.
</para> </para>
</note> </note>
@ -1192,7 +1194,8 @@ ALTER TABLE products RENAME TO items;
<literal>USAGE</>, and <literal>ALL PRIVILEGES</>. For complete <literal>USAGE</>, and <literal>ALL PRIVILEGES</>. For complete
information on the different types of privileges supported by information on the different types of privileges supported by
<productname>PostgreSQL</productname>, refer to the <productname>PostgreSQL</productname>, refer to the
<command>GRANT</command> reference page. The following sections <xref linkend="sql-grant" endterm="sql-grant-title">
reference page. The following sections
and chapters will also show you how those privileges are used. and chapters will also show you how those privileges are used.
</para> </para>
@ -1453,8 +1456,8 @@ SHOW search_path;
$user,public $user,public
</screen> </screen>
The first element specifies that a schema with the same name as The first element specifies that a schema with the same name as
the current user is to be searched. Since no such schema exists the current user is to be searched. If no such schema exists,
yet, this entry is ignored. The second element refers to the the entry is ignored. The second element refers to the
public schema that we have seen already. public schema that we have seen already.
</para> </para>
@ -1737,7 +1740,7 @@ DROP TABLE products CASCADE;
the possible dependencies varies with the type of the object. You the possible dependencies varies with the type of the object. You
can also write <literal>RESTRICT</literal> instead of can also write <literal>RESTRICT</literal> instead of
<literal>CASCADE</literal> to get the default behavior which is to <literal>CASCADE</literal> to get the default behavior which is to
restrict drops of objects that other objects depend on. prevent drops of objects that other objects depend on.
</para> </para>
<note> <note>

View File

@ -1,4 +1,4 @@
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.21 2003/04/10 01:22:44 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/queries.sgml,v 1.22 2003/08/14 23:13:27 tgl Exp $ -->
<chapter id="queries"> <chapter id="queries">
<title>Queries</title> <title>Queries</title>
@ -1208,10 +1208,10 @@ SELECT <replaceable>select_list</replaceable>
</para> </para>
<para> <para>
When using <literal>LIMIT</>, it is a good idea to use an When using <literal>LIMIT</>, it is important to use an
<literal>ORDER BY</> clause that constrains the result rows into a <literal>ORDER BY</> clause that constrains the result rows into a
unique order. Otherwise you will get an unpredictable subset of unique order. Otherwise you will get an unpredictable subset of
the query's rows. --- You may be asking for the tenth through the query's rows. You may be asking for the tenth through
twentieth rows, but tenth through twentieth in what ordering? The twentieth rows, but tenth through twentieth in what ordering? The
ordering is unknown, unless you specified <literal>ORDER BY</>. ordering is unknown, unless you specified <literal>ORDER BY</>.
</para> </para>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.81 2003/08/09 22:50:22 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.82 2003/08/14 23:13:27 tgl Exp $
--> -->
<chapter id="sql-syntax"> <chapter id="sql-syntax">
@ -450,14 +450,7 @@ CAST ( '<replaceable>string</replaceable>' AS <replaceable>type</replaceable> )
'{{1,2,3},{4,5,6},{7,8,9}}' '{{1,2,3},{4,5,6},{7,8,9}}'
</programlisting> </programlisting>
This constant is a two-dimensional, 3-by-3 array consisting of three This constant is a two-dimensional, 3-by-3 array consisting of three
subarrays of integers. subarrays of integers. For more information see <xref linkend="arrays">.
</para>
<para>
Individual array elements can be placed between double-quote
marks (<literal>"</literal>) <!-- " --> to avoid ambiguity
problems with respect to whitespace. Without quote marks, the
array-value parser will skip leading whitespace.
</para> </para>
<para> <para>
@ -1190,8 +1183,10 @@ CAST ( <replaceable>expression</replaceable> AS <replaceable>type</replaceable>
one of the two standard cast syntaxes is used to do a run-time one of the two standard cast syntaxes is used to do a run-time
conversion, it will internally invoke a registered function to conversion, it will internally invoke a registered function to
perform the conversion. By convention, these conversion functions perform the conversion. By convention, these conversion functions
have the same name as their output type, but this is not something have the same name as their output type, and thus the <quote>function-like
that a portable application should rely on.) syntax</> is nothing more than a direct invocation of the underlying
conversion function. Obviously, this is not something that a portable
application should rely on.)
</para> </para>
</sect2> </sect2>
@ -1349,8 +1344,10 @@ SELECT ... WHERE x &lt;&gt; 0 AND y/x &gt; 1.5;
<programlisting> <programlisting>
SELECT ... WHERE CASE WHEN x &lt;&gt; 0 THEN y/x &gt; 1.5 ELSE false END; SELECT ... WHERE CASE WHEN x &lt;&gt; 0 THEN y/x &gt; 1.5 ELSE false END;
</programlisting> </programlisting>
A <literal>CASE</> construct used in this fashion will defeat optimization attempts, A <literal>CASE</> construct used in this fashion will defeat optimization
so it should only be done when necessary. attempts, so it should only be done when necessary. (In this particular
example, it would doubtless be best to sidestep the problem by writing
<literal>y &gt; 1.5*x</> instead.)
</para> </para>
</sect2> </sect2>
</sect1> </sect1>

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/typeconv.sgml,v 1.31 2003/05/26 00:11:27 tgl Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/typeconv.sgml,v 1.32 2003/08/14 23:13:27 tgl Exp $
--> -->
<chapter Id="typeconv"> <chapter Id="typeconv">
@ -113,15 +113,16 @@ with, and perhaps converted to, the types of the target columns.
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term> <term>
<literal>UNION</literal> and <literal>CASE</literal> constructs <literal>UNION</literal>, <literal>CASE</literal>, and <literal>ARRAY</literal> constructs
</term> </term>
<listitem> <listitem>
<para> <para>
Since all query results from a unionized <literal>SELECT</literal> statement must appear in a single Since all query results from a unionized <literal>SELECT</literal> statement
set of columns, the types of the results must appear in a single set of columns, the types of the results of each
of each <literal>SELECT</> clause must be matched up and converted to a uniform set. <literal>SELECT</> clause must be matched up and converted to a uniform set.
Similarly, the branch expressions of a <literal>CASE</> construct must be converted to Similarly, the branch expressions of a <literal>CASE</> construct must be
a common type so that the <literal>CASE</> expression as a whole has a known output type. converted to a common type so that the <literal>CASE</> expression as a whole
has a known output type. The same holds for <literal>ARRAY</> constructs.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
@ -754,7 +755,8 @@ padding spaces.
</sect1> </sect1>
<sect1 id="typeconv-union-case"> <sect1 id="typeconv-union-case">
<title><literal>UNION</> and <literal>CASE</> Constructs</title> <title><literal>UNION</literal>, <literal>CASE</literal>, and
<literal>ARRAY</literal> Constructs</title>
<para> <para>
SQL <literal>UNION</> constructs must match up possibly dissimilar types to SQL <literal>UNION</> constructs must match up possibly dissimilar types to
@ -762,12 +764,13 @@ become a single result set. The resolution algorithm is applied separately
to each output column of a union query. The <literal>INTERSECT</> and to each output column of a union query. The <literal>INTERSECT</> and
<literal>EXCEPT</> constructs resolve dissimilar types in the same way as <literal>EXCEPT</> constructs resolve dissimilar types in the same way as
<literal>UNION</>. <literal>UNION</>.
A <literal>CASE</> construct also uses the identical algorithm to match up its A <literal>CASE</> construct uses the identical algorithm to match up its
component expressions and select a result data type. component expressions and select a result data type, as does <literal>ARRAY</>.
</para> </para>
<procedure> <procedure>
<title><literal>UNION</> and <literal>CASE</> Type Resolution</title> <title><literal>UNION</literal>, <literal>CASE</literal>, and
<literal>ARRAY</literal> Type Resolution</title>
<step performance="required"> <step performance="required">
<para> <para>