Re: Revisiting extract(epoch from timestamp)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, hubert depesz lubaczewski <depesz(at)depesz(dot)com>
Subject: Re: Revisiting extract(epoch from timestamp)
Date: 2012-04-09 19:56:24
Message-ID: 12254.1334001384@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)commandprompt(dot)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 where it really is the best way.

> You mean, having the constraint declaration rotate the timestamptz
> column to timestamp and then extract the epoch from that? If you go
> that route, then the queries that wish to take advantage of constraint
> exclusion would have to do likewise, which becomes ugly rather quickly.

No, I'm wondering why the partition constraints wouldn't just be

tstzcol >= '2012-04-01 00:00' and tstzcol < '2012-05-01 00:00'

or similar. What sort of constraint have you got in mind that is more
naturally expressed involving extract(epoch)? (And will the planner
think so too?)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2012-04-09 20:11:32 Re: bug in fast-path locking
Previous Message Peter Eisentraut 2012-04-09 19:47:45 should encoding names be quoted in error messages?