oguimbal / pg-mem

An in memory postgres DB instance for your unit tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Subtracting interval from dates gives the wrong output.

Alexnortung opened this issue · comments

Describe the bug

Subtracting dates with intervals seems to give the wrong output. for example, subtracting one year from 2022-01-01 returns 2021-01-06. But in postgres it produces the expected 2021-01-01.

To Reproduce

SELECT '2022-01-01'::date - interval '1 year';
SELECT '2022-01-01'::date - interval '1 month';

pg-mem version

Used playground