Re: bug in date_part() function in 6.5.2, 7.0.2

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
Cc: analyst(at)sibinet(dot)ru, pgsql-bugs(at)postgresql(dot)org
Subject: Re: bug in date_part() function in 6.5.2, 7.0.2
Date: 2000-09-08 14:36:47
Message-ID: 39B8F97F.E94ED8C3@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2000-09-08 16:00:51 createuser fails
Previous Message Tom Lane 2000-09-08 14:09:00 Re: bug in date_part() function in 6.5.2, 7.0.2