Re: Aggregate time data on half hour interval

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Lars <lars(at)sscsinc(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Aggregate time data on half hour interval
Date: 2000-07-20 06:00:27
Message-ID: 3976957B.8BCD90F1@alumni.caltech.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> In the long run it seems like date_trunc ought to be more flexible
> than it is...

Now that we can easily overload built-in functions, we should be able to
have an alternate form for date_trunc() which can do this. Say, by
accepting a double value as the first argument, which would be the
amount to round, in seconds, like this:

date_trunc(20.0, tsfield)

or by adding one more argument which would be the units, like this:

date_trunc('minutes', 20.0, tsfield)

I think I like this second one better.

Or are you proposing something specific for the current date_trunc()?
The current form is modeled on the Ingres function of the same name.

- Thomas

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-07-20 06:55:48 Re: Query problem - explicit casts
Previous Message Lars 2000-07-20 05:59:53 Re: Aggregate time data on half hour interval