diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-19 01:50:08 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-19 01:50:08 +0000 |
commit | 1e9a1a70adc1f36d9ba8cd67ce974f777df7aafb (patch) | |
tree | 2f254673cf73e55c6f78bc45d6ae4ce25ea307b3 /doc/src | |
parent | 8685c472235b7a5bcc786f66ba9adde44e3d670c (diff) | |
download | postgresql-1e9a1a70adc1f36d9ba8cd67ce974f777df7aafb.tar.gz postgresql-1e9a1a70adc1f36d9ba8cd67ce974f777df7aafb.zip |
Change array_push and array_cat so that they retain the lower bound of
the array (for array_push) or higher-dimensional array (for array_cat)
rather than decrementing it as before. This avoids generating lower
bounds other than one for any array operation within the SQL spec. Per
recent discussion.
Interestingly, this seems to have been the original behavior, because
while updating the docs I noticed that a large fraction of relevant
examples were *wrong* for the old behavior and are now right. Is it
worth correcting this in the back-branch docs?
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/array.sgml | 14 | ||||
-rw-r--r-- | doc/src/sgml/func.sgml | 4 |
2 files changed, 8 insertions, 10 deletions
diff --git a/doc/src/sgml/array.sgml b/doc/src/sgml/array.sgml index c24646e43ca..9255144999d 100644 --- a/doc/src/sgml/array.sgml +++ b/doc/src/sgml/array.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.47 2005/11/17 22:14:50 tgl Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.48 2005/11/19 01:50:08 tgl Exp $ --> <sect1 id="arrays"> <title>Arrays</title> @@ -391,13 +391,11 @@ SELECT ARRAY[5,6] || ARRAY[[1,2],[3,4]]; </para> <para> - When a single element is pushed on to the beginning of a one-dimensional - array, the result is an array with a lower bound subscript equal to - the right-hand operand's lower bound subscript, minus one. When a single - element is pushed on to the end of a one-dimensional array, the result is - an array retaining the lower bound of the left-hand operand. For example: + When a single element is pushed on to either the beginning or end of a + one-dimensional array, the result is an array with the same lower bound + subscript as the array operand. For example: <programlisting> -SELECT array_dims(1 || ARRAY[2,3]); +SELECT array_dims(1 || '[0:1]={2,3}'::int[]); array_dims ------------ [0:2] @@ -441,7 +439,7 @@ SELECT array_dims(ARRAY[[1,2],[3,4]] || ARRAY[[5,6],[7,8],[9,0]]); SELECT array_dims(ARRAY[1,2] || ARRAY[[3,4],[5,6]]); array_dims ------------ - [0:2][1:2] + [1:3][1:2] (1 row) </programlisting> </para> diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 8bc963b02ff..c0e364a30b8 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.293 2005/11/17 22:14:50 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.294 2005/11/19 01:50:08 tgl Exp $ PostgreSQL documentation --> @@ -7484,7 +7484,7 @@ SELECT NULLIF(value, '(none)') ... </entry> <entry><type>int</type></entry> <entry>returns lower bound of the requested array dimension</entry> - <entry><literal>array_lower(array_prepend(0, ARRAY[1,2,3]), 1)</literal></entry> + <entry><literal>array_lower('[0:2]={1,2,3}'::int[], 1)</literal></entry> <entry><literal>0</literal></entry> </row> <row> |