你如何在 postgres 9.4 中将一个 int4range 取消嵌套到多行?
How do you unnest an int4range to multiple rows in postgres 9.4?
输入:
select 'a string', unnest(int4range(98,104));
当前输出:
"ERROR: function unnest(int4range) does not exist"
期望的输出:
'a string', 98
'a string', 99
'a string', 100
'a string', 101
'a string', 102
'a string', 103
generate_series
:
select 'a string', generate_series(lower(r), upper(r))
from (values (int4range(98,104))) r(r);
?column? | generate_series
----------+-----------------
a string | 98
a string | 99
a string | 100
a string | 101
a string | 102
a string | 103
a string | 104
输入:
select 'a string', unnest(int4range(98,104));
当前输出:
"ERROR: function unnest(int4range) does not exist"
期望的输出:
'a string', 98
'a string', 99
'a string', 100
'a string', 101
'a string', 102
'a string', 103
generate_series
:
select 'a string', generate_series(lower(r), upper(r))
from (values (int4range(98,104))) r(r);
?column? | generate_series
----------+-----------------
a string | 98
a string | 99
a string | 100
a string | 101
a string | 102
a string | 103
a string | 104