mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Clean up wrong, misleading, or obsolete documentation about array types,
particularly in the CREATE TYPE reference page. Fix some other errors in the CREATE TYPE page, too.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.12 2001/09/09 17:21:44 petere Exp $ -->
|
||||
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/array.sgml,v 1.13 2001/11/03 21:42:47 tgl Exp $ -->
|
||||
|
||||
<chapter id="arrays">
|
||||
<title>Arrays</title>
|
||||
@@ -23,15 +23,15 @@ CREATE TABLE sal_emp (
|
||||
<structname>sal_emp</structname> with a <type>text</type> string
|
||||
(<structfield>name</structfield>), a one-dimensional array of type
|
||||
<type>integer</type> (<structfield>pay_by_quarter</structfield>),
|
||||
which shall represent the employee's salary by quarter, and a
|
||||
which represents the employee's salary by quarter, and a
|
||||
two-dimensional array of <type>text</type>
|
||||
(<structfield>schedule</structfield>), which represents the
|
||||
employee's weekly schedule.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Now we do some <command>INSERT</command>s; note that when appending
|
||||
to an array, we enclose the values within braces and separate them
|
||||
Now we do some <command>INSERT</command>s. Observe that to write an array
|
||||
value, we enclose the element values within braces and separate them
|
||||
by commas. If you know C, this is not unlike the syntax for
|
||||
initializing structures.
|
||||
|
||||
@@ -200,8 +200,7 @@ SELECT * FROM sal_emp WHERE pay_by_quarter[1] = 10000 OR
|
||||
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 <productname>PostgreSQL</productname> distribution,
|
||||
in the contributions directory, there is an extension to
|
||||
<productname>PostgreSQL</productname> that defines new functions and
|
||||
there is an extension available that defines new functions and
|
||||
operators for iterating over array values. Using this, the above
|
||||
query could be:
|
||||
|
||||
|
Reference in New Issue
Block a user