diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-29 00:33:44 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-29 00:33:44 +0000 |
| commit | bee217924d51af8cf0411167bfc8a7eb55122577 (patch) | |
| tree | ab6d3f311de5fd6b415e0bdf032205ed503ba95c /src/test/regress/sql/arrays.sql | |
| parent | df7618020b3845a51d1ba80cb9abfc6df5dfeaff (diff) | |
| download | postgresql-bee217924d51af8cf0411167bfc8a7eb55122577.tar.gz | |
Support expressions of the form 'scalar op ANY (array)' and
'scalar op ALL (array)', where the operator is applied between the
lefthand scalar and each element of the array. The operator must
yield boolean; the result of the construct is the OR or AND of the
per-element results, respectively.
Original coding by Joe Conway, after an idea of Peter's. Rewritten
by Tom to keep the implementation strictly separate from subqueries.
Diffstat (limited to 'src/test/regress/sql/arrays.sql')
| -rw-r--r-- | src/test/regress/sql/arrays.sql | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql index 8b18ffb9eb..c3bcdd5e3a 100644 --- a/src/test/regress/sql/arrays.sql +++ b/src/test/regress/sql/arrays.sql @@ -154,6 +154,22 @@ SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] AS "{{a,bc},{def,hijk SELECT ARRAY[['a','bc'],['def','hijk']]::text[]::varchar[] is of (varchar[]) as "TRUE"; SELECT CAST(ARRAY[[[[[['a','bb','ccc']]]]]] as text[]) as "{{{{{{a,bb,ccc}}}}}}"; +-- scalar op any/all (array) +select 33 = any ('{1,2,3}'); +select 33 = any ('{1,2,33}'); +select 33 = all ('{1,2,33}'); +select 33 >= all ('{1,2,33}'); +-- boundary cases +select null::int >= all ('{1,2,33}'); +select null::int >= all ('{}'); +select null::int >= any ('{}'); +-- cross-datatype +select 33.4 = any (array[1,2,3]); +select 33.4 > all (array[1,2,3]); +-- errors +select 33 * any ('{1,2,3}'); +select 33 * any (44); + -- test indexes on arrays create temp table arr_tbl (f1 int[] unique); insert into arr_tbl values ('{1,2,3}'); |
