oguimbal / pg-mem

An in memory postgres DB instance for your unit tests
MIT License
1.98k stars 97 forks source link

Subtracting interval from dates gives the wrong output. #394

Open Alexnortung opened 6 months ago

Alexnortung commented 6 months ago

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