polygon-models/macros/streamline/get_base_table_udft.sql
cantjaso 9565d67c4d
Jason/blocks (#36)
* Models for blocks stream

* add the utils for post_hook

* add the bronze streamline schema

* Update

* Update

* Duplicate bug fix

* Chainhead route fix

Co-authored-by: yulike <xiuyangguan@gmail.com>
2022-10-31 13:03:52 -04:00

24 lines
457 B
PL/PgSQL

{% macro create_udtf_get_base_table(schema) %}
create or replace function {{ schema }}.udtf_get_base_table(max_height integer)
returns table (height number)
as
$$
with base as (
select
row_number() over (
order by
seq4()
) as id
from
table(generator(rowcount => 100000000))
)
select
id as height
from
base
where
id <= max_height
$$
;
{% endmacro %}