Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- with
- t(i,x,y) as (values (1,'2014-03-03'::timestamp, '2016-07-07'::timestamp),(2,'2015-05-05','2015-06-06')),
- u as (
- select
- *,
- generate_series(extract(year from x)::int, extract(year from y)::int) as z
- from
- t)
- select
- *,
- tsrange(x,y) * tsrange(make_timestamp(z,1,1,0,0,0), make_timestamp(z+1,1,1,0,0,0))
- from u;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement