[HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Tom Lane
A long time ago, we had this bug report: http://archives.postgresql.org/pgsql-bugs/2003-02/msg00069.php in consequence of which, I changed timestamp_part() so that it would rotate a timestamp-without-timezone from the local timezone to GMT before extracting the epoch offset (commit

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Robert Haas
On Mon, Apr 9, 2012 at 1:30 PM, Tom Lane t...@sss.pgh.pa.us wrote: A long time ago, we had this bug report: http://archives.postgresql.org/pgsql-bugs/2003-02/msg00069.php in consequence of which, I changed timestamp_part() so that it would rotate a timestamp-without-timezone from the local

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 so that we could mark it immutable. On the other hand, it's not entirely apparent why people would need to create indexes on the epoch value rather than just indexing the timestamp itself Well, it makes for smaller indexes if you don't

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Mon, Apr 9, 2012 at 1:30 PM, Tom Lane t...@sss.pgh.pa.us wrote: http://archives.postgresql.org/pgsql-general/2012-01/msg00649.php The above-linked discussion also brings up a different point, which is that extracting the epoch from a timestamptz is

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Tom Lane
Greg Sabino Mullane g...@turnstep.com writes: so that we could mark it immutable. On the other hand, it's not entirely apparent why people would need to create indexes on the epoch value rather than just indexing the timestamp itself Well, it makes for smaller indexes if you don't really

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Alvaro Herrera
Excerpts from Tom Lane's message of lun abr 09 15:04:10 -0300 2012: Robert Haas robertmh...@gmail.com writes: On Mon, Apr 9, 2012 at 1:30 PM, Tom Lane t...@sss.pgh.pa.us wrote: http://archives.postgresql.org/pgsql-general/2012-01/msg00649.php The above-linked discussion also brings up a

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: Robert Haas robertmh...@gmail.com writes: If somebody needs it I'd probably be in favor of doing it. I'm not sure I'd do it on spec. It would be useful to have a simple function to use with timestamp in constraint exclusion without having to

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Alvaro Herrera
Excerpts from Tom Lane's message of lun abr 09 15:38:21 -0300 2012: Alvaro Herrera alvhe...@commandprompt.com writes: Robert Haas robertmh...@gmail.com writes: If somebody needs it I'd probably be in favor of doing it. I'm not sure I'd do it on spec. It would be useful to have a

Re: [HACKERS] Revisiting extract(epoch from timestamp)

2012-04-09 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes: Excerpts from Tom Lane's message of lun abr 09 15:38:21 -0300 2012: What exactly would you do with it there that you couldn't do more easily and clearly with plain timestamp comparisons? I'm willing to be convinced, but I want to see a case