Re: Revisiting extract(epoch from timestamp)

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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:23:15
Message-ID: 1333998695-sup-1668@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Excerpts from Tom Lane's message of lun abr 09 15:38:21 -0300 2012:
>
> Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> >> Robert Haas <robertmhaas(at)gmail(dot)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 use contorted expressions ...
> > An immutable extract_epoch(timestamptz) would fit the bill.
>
> 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.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-04-09 19:37:05 Re: HOT updates & REDIRECT line pointers
Previous Message Bruce Momjian 2012-04-09 19:21:36 Re: Regarding column reordering project for GSoc 2012