Received: from mail.postgresql.org (webmail.postgresql.org [216.126.85.28]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id eB4KFfG29357 for ; Mon, 4 Dec 2000 15:15:41 -0500 (EST) (envelope-from pgsql-docs-owner@postgresql.org) Received: from olympus.scw.org (209-9-156-98.sdsl.cais.net [209.9.156.98]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eB4G4x066906 for ; Mon, 4 Dec 2000 11:05:00 -0500 (EST) (envelope-from jburton@scw.org) Received: from hades (eos.scw.org [209.9.156.112]) by olympus.scw.org (8.10.1/8.10.1) with ESMTP id eB4G4bg17017 for ; Mon, 4 Dec 2000 11:04:37 -0500 From: "Joel Burton" Organization: Support Center of Washington To: pgsql-docs@postgresql.org Date: Mon, 4 Dec 2000 11:04:37 -0500 MIME-Version: 1.0 Content-type: Multipart/Mixed; boundary=Message-Boundary-5249 Subject: Patches for docs CC: JOEL@olympus.scw.org Message-ID: <3A2B7A45.15255.2EBC8E@localhost> X-mailer: Pegasus Mail for Win32 (v3.12c) X-Archive-Number: 200012/4 X-Sequence-Number: 51 --Message-Boundary-5249 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Adds discussion of using array features in contrib/ to iterate over arrays, adds a few forgotten math functions, and other misc things. See patch for details. This is my first patch submission. Please feel free to tear me to pieces if I'm not submitting it in the easiest way for the maintainers to understand and add. :-) Thanks! -- Joel Burton, Director of Information Systems -*- jburton@scw.org Support Center of Washington (www.scw.org) --Message-Boundary-5249 Content-type: text/plain; charset=US-ASCII Content-disposition: inline Content-description: Attachment information. The following section of this message contains a file attachment prepared for transmission using the Internet MIME message format. If you are using Pegasus Mail, or any another MIME-compliant system, you should be able to save it or view it from within your mailer. If you cannot, please ask your system administrator for assistance. ---- File information ----------- File: wjb-doc-patches Date: 4 Dec 2000, 11:01 Size: 6384 bytes. Type: Text --Message-Boundary-5249 Content-type: Application/Octet-stream; name="wjb-doc-patches"; type=Text Content-disposition: attachment; filename="wjb-doc-patches" *** ./doc/src/sgml/array.sgml.orig Mon Dec 4 01:32:07 2000 --- ./doc/src/sgml/array.sgml Mon Dec 4 01:38:12 2000 *************** *** 153,156 **** --- 153,194 ---- unspecified length. + + To search for a value in an array, you must check each value of + the array. This can be done by hand (if you know the size of the array): + + + SELECT * FROM sal_emp WHERE pay_by_quarter[1] = 10000 OR + pay_by_quarter[2] = 10000 OR + pay_by_quarter[3] = 10000 OR + pay_by_quarter[4] = 10000; + + + However, this quickly becomes tedious for large arrays, and is not helpful + if the size of the array is unknown. Although it is not part of the primary + PostgreSQL distribution, in the contributions directory, there is an extension to + PostgreSQL that defines new functions and operators for iterating over array + values. Using this, the above query could be: + + + SELECT * FROM sal_emp WHERE pay_by_quarter[1:4] *= 10000; + + + To search the entire array (not just specified columns), you could use: + + + SELECT * FROM sal_emp WHERE pay_by_quarter *= 10000; + + + In addition, you could find rows where the array had all values equal to + 10,000 with: + + + SELECT * FROM sal_emp WHERE pay_by_quarter **= 10000; + + + To install this optional module, look in the /contrib/array directory + of the PostgreSQL source installation. + + *** ./doc/src/sgml/datatype.sgml.orig Mon Dec 4 01:28:32 2000 --- ./doc/src/sgml/datatype.sgml Mon Dec 4 01:31:51 2000 *************** *** 138,143 **** --- 138,148 ---- exact numeric with selectable precision + oid + + object id (unique identifier for every PostgreSQL object + + path open and closed geometric path in 2D plane *************** *** 155,161 **** serial ! unique id for indexing and cross-reference text --- 160,166 ---- serial ! unique integer id for indexing and cross-reference text *************** *** 1383,1389 **** NULL is an effective substitute. bool can be used in any boolean expression, and boolean expressions ! always evaluate to a result compatible with this type. bool uses 1 byte of storage. --- 1388,1402 ---- NULL is an effective substitute. bool can be used in any boolean expression, and boolean expressions ! always evaluate to a result compatible with this type. ! ! ! ! Note that bool values do not have a numeric equivalent. ! PostgreSQL will reject, for example, a boolean value input as an number ! (unless entered as a string, '1' for true, and '0' for false). ! A bool value cannot be CAST into a numeric values. ! bool uses 1 byte of storage. *** ./doc/src/sgml/func.sgml.orig Mon Dec 4 01:20:40 2000 --- ./doc/src/sgml/func.sgml Mon Dec 4 01:23:59 2000 *************** *** 88,93 **** --- 88,103 ---- abs(-17.4) + ceil(numeric) + numeric + smallest integer >= value + + + floor(numeric) + numeric + largest integer <= value + + degrees(float8) float8 radians to degrees *************** *** 110,115 **** --- 120,131 ---- float8 base 10 logarithm log(2.0) + + + log(numeric, numeric) + numeric + logarithm base n of m + log(5.0, 2.0) pi() *** ./doc/src/sgml/oper.sgml.orig Mon Dec 4 01:17:45 2000 --- ./doc/src/sgml/oper.sgml Mon Dec 4 01:19:27 2000 *************** *** 25,39 **** To view all variations of the "||" string concatenation operator, try ! SELECT oprleft, oprright, oprresult, oprcode ! FROM pg_operator WHERE oprname = '||'; ! ! oprleft|oprright|oprresult|oprcode ! -------+--------+---------+------- ! 25| 25| 25|textcat ! 1042| 1042| 1042|textcat ! 1043| 1043| 1043|textcat ! (3 rows) --- 25,39 ---- To view all variations of the "||" string concatenation operator, try ! \do || ! List of operators ! Op | Left arg | Right arg | Result | Description ! ----+-------------------+-------------------+--------+----------------------- ! || | bit | bit | bit | bitwise concatenation ! || | character | character | text | concatenate ! || | character varying | character varying | text | concatenate ! || | text | text | text | concatenate ! (4 rows) *** ./doc/src/sgml/syntax.sgml.orig Mon Dec 4 01:08:21 2000 --- ./doc/src/sgml/syntax.sgml Mon Dec 4 01:15:57 2000 *************** *** 435,440 **** --- 435,446 ---- (e.g. '\tab'). + + Backslashes may also be used to insert newlines (\n), tabs (\t), + linefeeds (\r), or any arbitrary character (\xxx, where xxx is the character code + in octal). + + --Message-Boundary-5249--