1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-31 17:02:12 +03:00

Updates for array documentation, from Joe Conway.

This commit is contained in:
Tom Lane
2003-08-19 06:06:48 +00:00
parent 80860c32d9
commit 432fb5b886
3 changed files with 85 additions and 23 deletions

View File

@@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.82 2003/08/14 23:13:27 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.83 2003/08/19 06:06:48 tgl Exp $
-->
<chapter id="sql-syntax">
@@ -1270,6 +1270,23 @@ SELECT ARRAY[[1,2],[3,4]];
at the same level must produce sub-arrays of identical dimensions.
</para>
<para>
Multidimensional array constructor elements can be anything yielding
an array of the proper kind, not only a sub-<literal>ARRAY</> construct.
For example:
<programlisting>
create table arr(f1 int[], f2 int[]);
CREATE TABLE
insert into arr values (ARRAY[[1,2],[3,4]],ARRAY[[5,6],[7,8]]);
INSERT 2635544 1
select ARRAY[f1, f2, '{{9,10},{11,12}}'::int[]] from arr;
array
------------------------------------------------
{{{1,2},{3,4}},{{5,6},{7,8}},{{9,10},{11,12}}}
(1 row)
</programlisting>
</para>
<para>
It is also possible to construct an array from the results of a
subquery. In this form, the array constructor is written with the