avg() for timestamp - Mailing list pgsql-hackers

From Neil Conway
Subject avg() for timestamp
Date
Msg-id 404A8E0C.6080609@samurai.com
Whole thread Raw
Responses Re: avg() for timestamp  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: avg() for timestamp  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-hackers
It seems to me the following should Just Work:

nconway=# create table t1 (a timestamp);
CREATE TABLE
nconway=# insert into t1 values (now());
INSERT 17164 1
nconway=# insert into t1 values (now());
INSERT 17165 1
nconway=# insert into t1 values (now());
INSERT 17166 1
nconway=# insert into t1 values (now());
INSERT 17167 1
nconway=# select avg(a) from t1;
ERROR:  function avg(timestamp without time zone) does not exist
HINT:  No function matches the given name and argument types. You may 
need to add explicit type casts.

It seems we could add the necessary aggregate function to do this. 
Seems worth doing to me.

Any comments?

-Neil


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [pgsql-hackers-win32] Tablespaces
Next
From: Tom Lane
Date:
Subject: Re: avg() for timestamp