SELECT ('1 year'::interval) = ('360 days'::interval); --> TRUE :-)
SELECT ('1 year'::interval) = ('365 days'::interval); --> FALSE :-)
On Tue, Aug 7, 2012 at 4:42 PM, Dmitry Koterov <dmitry@xxxxxxxxxx> wrote:
Hello.I've just discovered a very strange thing:SELECT '1 mon'::interval = '30 days'::interval --> TRUE???This returns TRUE (also affected when I create an unique index using an interval column). Why?I know that Postgres stores monthes, days and seconds in interval values separately. So how to make "=" to compare intervals "part-by-part" and not treat "1 mon" as "30 days"?P.S.Reproduced at least in 8.4 and 9.1.