11 lines
221 B
Text
11 lines
221 B
Text
|
|
create or replace function power2(n) as (
|
||
|
|
with recursive cte as (
|
||
|
|
select 0 as i, 1::UHUGEINT as p
|
||
|
|
union all
|
||
|
|
select i+1 as i, p*2 as p
|
||
|
|
from cte
|
||
|
|
where i < n )
|
||
|
|
select last(p order by i)
|
||
|
|
from cte
|
||
|
|
);
|