Re: bug in date_part() function in 6.5.2, 7.0.2 - Mailing list pgsql-bugs

From Thomas Lockhart
Subject Re: bug in date_part() function in 6.5.2, 7.0.2
Date
Msg-id 39B8F97F.E94ED8C3@alumni.caltech.edu
Whole thread Raw
In response to Re: bug in date_part() function in 6.5.2, 7.0.2  (Karel Zak <zakkr@zf.jcu.cz>)
List pgsql-bugs
> Seems like you could just skip step 3 and call localtime() with fields
> indicating midnight of the specified date.  Then use the complete
> localtime result (don't discard any fields) and you should be OK, no?

OK, I have a solution which involves mktime(). As a side effect, I've
stripped some code, so date and date,time to timestamp conversions no
longer have to run through a complete conversion via a tm structure.
Things should be faster (unless mktime() is substantially slower than
the other support routines). btw, the date/timetz to timestamp
conversion routine has shrunk down to one line since it turns out all
required fields were already available :)

Regression tests pass (which I guess tells me that they need some added
cases, since they passed before too); will commit sometime soon.

                     - Thomas

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: bug in date_part() function in 6.5.2, 7.0.2
Next
From: pgsql-bugs@postgresql.org
Date:
Subject: createuser fails