これで締め切りが決まります:
select id,
title,
created_at + interval '1' day * claim_window as deadline
from projects
または、関数make_interval
使用可能:
select id,
title,
created_at + make_interval(days => claim_window) as deadline
from projects
期限が過ぎているすべてのプロジェクトを取得するには、次を使用します:
select *
from (
select id,
created_at + interval '1' day * claim_window as deadline
from projects
) t
where localtimestamp at time zone 'UTC' > deadline