diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml index 4109cbafa6..fc6cdc331c 100644 --- a/doc/src/sgml/ddl.sgml +++ b/doc/src/sgml/ddl.sgml @@ -1,4 +1,4 @@ - + Data Definition @@ -490,7 +490,7 @@ CREATE TABLE products ( price numeric NOT NULL CHECK (price > 0) ); - 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. @@ -578,7 +578,7 @@ CREATE TABLE products ( least) two rows in the table where the values of each of the corresponding columns that are part of the constraint are equal. 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 rows that contain a null value in at least one of the constrained 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 used as a unique identifier for rows in the table. (This is a 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 documentation purposes and for client applications. For example, a GUI application that allows modifying row values probably needs @@ -850,8 +850,9 @@ CREATE TABLE capitals ( In this case, a row of capitals inherits all attributes (name, population, and altitude) from its parent, cities. The type of the attribute name is - text, a native PostgreSQL type for variable length - ASCII strings. The type of the attribute population is + text, a native PostgreSQL type + for variable length character strings. The type of the attribute + population is float, a native PostgreSQL type for double precision floating-point numbers. State capitals have an extra attribute, state, that shows their state. In PostgreSQL, @@ -964,7 +965,7 @@ WHERE c.altitude > 500 and c.tableoid = p.oid; In previous versions of PostgreSQL, the 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 * to the table name. For example @@ -1180,7 +1181,8 @@ ALTER TABLE products RENAME TO items; To change the owner of a table, index, sequence, or view, use the - ALTER TABLE command. + + command. @@ -1192,7 +1194,8 @@ ALTER TABLE products RENAME TO items; USAGE, and ALL PRIVILEGES. For complete information on the different types of privileges supported by PostgreSQL, refer to the - GRANT reference page. The following sections + + reference page. The following sections and chapters will also show you how those privileges are used. @@ -1453,8 +1456,8 @@ SHOW search_path; $user,public The first element specifies that a schema with the same name as - the current user is to be searched. Since no such schema exists - yet, this entry is ignored. The second element refers to the + the current user is to be searched. If no such schema exists, + the entry is ignored. The second element refers to the public schema that we have seen already. @@ -1737,7 +1740,7 @@ DROP TABLE products CASCADE; the possible dependencies varies with the type of the object. You can also write RESTRICT instead of CASCADE 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. diff --git a/doc/src/sgml/queries.sgml b/doc/src/sgml/queries.sgml index 04029f529b..d3ec786ac2 100644 --- a/doc/src/sgml/queries.sgml +++ b/doc/src/sgml/queries.sgml @@ -1,4 +1,4 @@ - + Queries @@ -1208,10 +1208,10 @@ SELECT select_list - When using LIMIT, it is a good idea to use an + When using LIMIT, it is important to use an ORDER BY clause that constrains the result rows into a 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 ordering is unknown, unless you specified ORDER BY. diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index c77456a0e8..8151c63c8c 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1,5 +1,5 @@ @@ -450,14 +450,7 @@ CAST ( 'string' AS type ) '{{1,2,3},{4,5,6},{7,8,9}}' This constant is a two-dimensional, 3-by-3 array consisting of three - subarrays of integers. - - - - Individual array elements can be placed between double-quote - marks (") to avoid ambiguity - problems with respect to whitespace. Without quote marks, the - array-value parser will skip leading whitespace. + subarrays of integers. For more information see . @@ -1190,8 +1183,10 @@ CAST ( expression AS type one of the two standard cast syntaxes is used to do a run-time conversion, it will internally invoke a registered function to perform the conversion. By convention, these conversion functions - have the same name as their output type, but this is not something - that a portable application should rely on.) + have the same name as their output type, and thus the function-like + 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.) @@ -1349,8 +1344,10 @@ SELECT ... WHERE x <> 0 AND y/x > 1.5; SELECT ... WHERE CASE WHEN x <> 0 THEN y/x > 1.5 ELSE false END; - A CASE construct used in this fashion will defeat optimization attempts, - so it should only be done when necessary. + A CASE construct used in this fashion will defeat optimization + attempts, so it should only be done when necessary. (In this particular + example, it would doubtless be best to sidestep the problem by writing + y > 1.5*x instead.) diff --git a/doc/src/sgml/typeconv.sgml b/doc/src/sgml/typeconv.sgml index fa59aba0fe..18bad527ff 100644 --- a/doc/src/sgml/typeconv.sgml +++ b/doc/src/sgml/typeconv.sgml @@ -1,5 +1,5 @@ @@ -113,15 +113,16 @@ with, and perhaps converted to, the types of the target columns. -UNION and CASE constructs +UNION, CASE, and ARRAY constructs -Since all query results from a unionized SELECT statement must appear in a single -set of columns, the types of the results -of each SELECT clause must be matched up and converted to a uniform set. -Similarly, the branch expressions of a CASE construct must be converted to -a common type so that the CASE expression as a whole has a known output type. +Since all query results from a unionized SELECT statement +must appear in a single set of columns, the types of the results of each +SELECT clause must be matched up and converted to a uniform set. +Similarly, the branch expressions of a CASE construct must be +converted to a common type so that the CASE expression as a whole +has a known output type. The same holds for ARRAY constructs. @@ -754,7 +755,8 @@ padding spaces. -<literal>UNION</> and <literal>CASE</> Constructs +<literal>UNION</literal>, <literal>CASE</literal>, and +<literal>ARRAY</literal> Constructs SQL 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 INTERSECT and EXCEPT constructs resolve dissimilar types in the same way as UNION. -A CASE construct also uses the identical algorithm to match up its -component expressions and select a result data type. +A CASE construct uses the identical algorithm to match up its +component expressions and select a result data type, as does ARRAY. -<literal>UNION</> and <literal>CASE</> Type Resolution +<literal>UNION</literal>, <literal>CASE</literal>, and +<literal>ARRAY</literal> Type Resolution