diff options
| author | Tom Lane | 2008-11-14 00:51:47 +0000 |
|---|---|---|
| committer | Tom Lane | 2008-11-14 00:51:47 +0000 |
| commit | c889ebce0aa5f848d680547e3af0aad8b9e577a7 (patch) | |
| tree | f3c16122152d35861e50bfdbfc11ab998d00f290 /src/test | |
| parent | 5b9453bcd3b28561c33495199c61c81994c58398 (diff) | |
Implement the basic form of UNNEST, ie unnest(anyarray) returns setof
anyelement. This lacks the WITH ORDINALITY option, as well as the multiple
input arrays option added in the most recent SQL specs. But it's still a
pretty useful subset of the spec's functionality, and it is enough to
allow obsoleting contrib/intagg.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/arrays.out | 62 | ||||
| -rw-r--r-- | src/test/regress/sql/arrays.sql | 7 |
2 files changed, 69 insertions, 0 deletions
diff --git a/src/test/regress/expected/arrays.out b/src/test/regress/expected/arrays.out index 1e990aff732..aecc74c5c4b 100644 --- a/src/test/regress/expected/arrays.out +++ b/src/test/regress/expected/arrays.out @@ -1161,3 +1161,65 @@ select array_agg(unique1) from tenk1 where unique1 < -15; (1 row) +select unnest(array[1,2,3]); + unnest +-------- + 1 + 2 + 3 +(3 rows) + +select * from unnest(array[1,2,3]); + unnest +-------- + 1 + 2 + 3 +(3 rows) + +select unnest(array[1,2,3,4.5]::float8[]); + unnest +-------- + 1 + 2 + 3 + 4.5 +(4 rows) + +select unnest(array[1,2,3,4.5]::numeric[]); + unnest +-------- + 1 + 2 + 3 + 4.5 +(4 rows) + +select unnest(array[1,2,3,null,4,null,null,5,6]); + unnest +-------- + 1 + 2 + 3 + + 4 + + + 5 + 6 +(9 rows) + +select unnest(array[1,2,3,null,4,null,null,5,6]::text[]); + unnest +-------- + 1 + 2 + 3 + + 4 + + + 5 + 6 +(9 rows) + diff --git a/src/test/regress/sql/arrays.sql b/src/test/regress/sql/arrays.sql index 586f65c2dd6..fc72f29f602 100644 --- a/src/test/regress/sql/arrays.sql +++ b/src/test/regress/sql/arrays.sql @@ -402,3 +402,10 @@ select array_agg(nullif(ten, 4)) from tenk1 where unique1 < 15; select cardinality(array_agg(unique1)) from tenk1 where unique1 < 15; select array_agg(unique1) from (select * from tenk1 order by unique1 asc) as tab where unique1 < 15; select array_agg(unique1) from tenk1 where unique1 < -15; + +select unnest(array[1,2,3]); +select * from unnest(array[1,2,3]); +select unnest(array[1,2,3,4.5]::float8[]); +select unnest(array[1,2,3,4.5]::numeric[]); +select unnest(array[1,2,3,null,4,null,null,5,6]); +select unnest(array[1,2,3,null,4,null,null,5,6]::text[]); |
