Good day!

I've checked on H2 manual and found that H2 supports unnesting of multiple 
arrays (http://www.h2database.com/html/functions.html#unnest). For example:

*select * from unnest(array[1, 2, 3], array['one', 'two', 'three']);*

gives desired results:




*1, one2, two3, three*
But unnest supports only array expressions, not array columns. I'm not 
quite sure I understand what is an array expression. Let's say I defined 
following table and single value:







*create table foo (  bar integer array,  baz character varying 
array);insert into foo (bar, baz) values (array[1, 2, 3], array['one', 
'two', 'three'])*
I can unnest each single column by executing following commands:



*select * from unnest(select bar from foo);select * from unnest(select baz 
from foo);*
returning expected results:








*123onetwothree*
So I supposed that expression "select bar from foo" returns an array 
expression (since it is accepted by the function). But when I tried to 
apply the same for multiple columns it fails:

*select * from unnest(select bar from foo, select baz from foo);*

results in an error:



*Syntax error in SQL statement "select * from unnest(select bar from foo, 
[*]select baz from foo)"; expected "identifier"; SQL statement:select * 
from unnest(select bar from foo, select baz from foo) [42001-222] 
42001/42001*
So, my question is: is it possible to unnest multiple array columns in H2?

Thanks!

With respect,
Artem

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/h2-database/ffe2d32f-e9b6-4cce-b991-67aecc3503fan%40googlegroups.com.

Reply via email to