Re: Problems with avg on interval data type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jeremy(at)horizonlive(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Problems with avg on interval data type
Date: 2001-05-18 16:08:07
Message-ID: 19676.990202087@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

pgsql-bugs(at)postgresql(dot)org writes:
> The query does an avg on an interval column and now gets the error:
> ERROR: Bad interval external representation '0'

Sorry about that :-(. A last-minute tightening of the allowed input
formats for interval broke avg(interval), but you're the first one to
notice.

I have corrected this in the sources for 7.1.2, but that will not help
you much unless you care to re-initdb with 7.1.2. If you don't want to
initdb, you can manually correct the erroneous catalog entry with

update pg_aggregate set agginitval = '{0 second,0 second}' where
aggname = 'avg' and aggbasetype = 1186;

Note you will need to do this in each extant database including
template1 (or at least all the databases where you plan to use
avg(interval)).

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Lockhart 2001-05-18 16:47:10 Re: Problems with avg on interval data type
Previous Message Tom Lane 2001-05-18 15:12:27 Re: "Unvisible" duplicates in SELECT [...] HAVING count(attrib) > 1

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2001-05-18 16:08:30 Re: AW: AW: Adding index flag showing tuple status
Previous Message Peter Eisentraut 2001-05-18 15:59:29 Re: Running config vars