メモ。
select date(date_trunc('month',current_date)); -- 月初
select date(date_trunc('month',current_date) + ' 1 month' + '-1 Day'); -- 月末日
select date(date_trunc('month',current_date) + ' 1 month'); -- 翌月の月初
postgres=# select date(date_trunc('month',current_date)); -- 月初
date
------------
2022-10-01
(1 row)
postgres=# select date(date_trunc('month',current_date) + ' 1 month' + '-1 Day'); -- 月末日
date
------------
2022-10-31
(1 row)
postgres=# select date(date_trunc('month',current_date) + ' 1 month'); -- 翌月の月初
date
------------
2022-11-01
(1 row)