Re: Getting "cache lookup failed for aggregate" error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Patrick Krecker <patrick(at)judicata(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting "cache lookup failed for aggregate" error
Date: 2014-06-24 23:25:47
Message-ID: 21621.1403652347@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Patrick Krecker <patrick(at)judicata(dot)com> writes:
> Hello everyone -- We received a strange error today on our production write
> master. During a routine maintenance script, we got the following error:

> "ERROR: cache lookup failed for aggregate 5953992"

> I think I found the culprit. We have a cron script that (among other
> things) recreates the aggregate function array_cat_aggregate()once every
> minute.

Um. Why's it do that?

> My guess is that a) transactions do not guarantee a snapshot of
> custom functions and b) we got unlucky and the aggregate was deleted during
> the execution of the UPDATE.

Yeah, there's no guarantee that dropping the aggregate wouldn't leave a
window for this type of failure.

9.4 might be a little better about this because it doesn't use SnapshotNow
for catalog fetches anymore, but I think you'd still be at some risk.

> Here is the query that produced the error:

It'd be more interesting to see what the cron script was doing to the
aggregate definition.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2014-06-24 23:57:16 Re: Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database
Previous Message Adrian Klaver 2014-06-24 23:24:06 Re: Re: Error When Trying to Use Npgsql to COPY into a PostgreSQL Database