I use postgreSQL 9.1. In my database there is a table which looks like
id | ... | values
-----------------------
1 | ... | {1,2,3}
2 | ... | {}
where id is an integer and values is an integer array. The arrays can be empty.
I need to unnest this list. If I query
select id, ..., unnest(values)
from table
I get three rows for id = 1 (as expected) and no lines for id = 2. Is there a way to get a result like
id | ... | unnest
-------------------
1 | ... | 1
1 | ... | 2
1 | ... | 3
2 | ... | null
i.e. a query which also contains the lines which have an empty array?