date bug (again) - Mailing list pgsql-bugs

From Darcy Buskermolen
Subject date bug (again)
Date
Msg-id 3.0.32.20000814223817.02ccebc0@mail.ok-connect.com
Whole thread Raw
Responses Re: date bug (again)  (Philip Warner <pjw@rhyme.com.au>)
Re: date bug (again)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
let me try this again...


Here is an other set of strange bugs I've discovered relating to dates.

this bug only rears it's head for 1 day a year form what I can find..
october 31'st, the intent of the queries is to get the last day of a month..




SELECT date_part('day', ('2000-11-1 0:00'::datetime + '-1day'))::int4 AS
days_in_month;

days_in_month
--------------
  31
(1 row)


SELECT date_part('day', (('2000-10-1 0:00'::datetime + '1 month') + '-1
day'))::int4 AS days_in_month;

days_in_month
--------------
  30
(1 row)


SELECT date_part('day', date_trunc('month', ('2000-10-1 0:00'::datetime +
'1 month')) + '-1 day')::int4 AS days_in_month;

days_in_month
--------------
  30
(1 row)

pgsql-bugs by date:

Previous
From: Darcy Buskermolen
Date:
Subject:
Next
From: "Andrei N.Sobchuck"
Date:
Subject: Re: Segmentation fault.