[h2] Re: Unnesting multiple array columns

2023-09-16 Thread Evgenij Ryazanov
Hello!

Yes, it is possible, but with valid SQL only.

Subqueries must be enclosed in parentheses, all your queries are incorrect. 
Valid queries are

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

In some cases H2 allows subqueries without parentheses due to historic 
reasons, but this undocumented syntax was implemented very inconsistently 
and actually it isn't possible to implement it in reliable way due to 
syntax conflicts. Don't use it, it is not supported and it may not work in 
future versions of H2 in places where it works in 2.2.222.

-- 
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/205acd8a-9de4-45d2-a894-bee45ca2faf5n%40googlegroups.com.


[h2] H2 Database Engine: New version released

2023-09-16 Thread Andrei Tokar


Hello Everybody,

A new version 2.2.224 of H2 is available at http://www.h2database.com
(you may have to click 'Refresh').

This is a patch release, and there are no incompatibilities with
on-disk format of v.2.2.222, so it can be used as drop in
replacement for 2.2.222. 

It will be available in Maven repository shortly.

For details, see the 'Change Log' at
http://www.h2database.com/html/changelog.html

P.S. If you reply to this message please use a different subject.

Have fun,
Andrei Tokar

-- 
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/356040df3219c8cd1e1af5170e2c42ff34a43d62.camel%40gmail.com.


[h2] Unnesting multiple array columns

2023-09-16 Thread Abeleshev Artem
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.