mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Add generate_subscripts, a series-generation function which generates an
array's subscripts. Pavel Stehule, some editorialization by me.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.65 2008/04/27 04:33:27 alvherre Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/array.sgml,v 1.66 2008/04/28 14:48:57 alvherre Exp $ -->
|
||||
|
||||
<sect1 id="arrays">
|
||||
<title>Arrays</title>
|
||||
@ -542,6 +542,21 @@ SELECT * FROM sal_emp WHERE 10000 = ALL (pay_by_quarter);
|
||||
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Alternatively, the <function>generate_subscripts</> function can be used.
|
||||
For example:
|
||||
|
||||
<programlisting>
|
||||
SELECT * FROM
|
||||
(SELECT pay_by_quarter,
|
||||
generate_subscripts(pay_by_quarter, 1) AS s
|
||||
FROM sal_emp) AS foo
|
||||
WHERE pay_by_quarter[s] = 10000;
|
||||
</programlisting>
|
||||
|
||||
This function is described in <xref linkend="functions-srf-subscripts">.
|
||||
</para>
|
||||
|
||||
<tip>
|
||||
<para>
|
||||
Arrays are not sets; searching for specific array elements
|
||||
|
Reference in New Issue
Block a user