Re: ERROR: cache lookup failed for type 0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michael Harris \(BR/EPA\)" <michael(dot)harris(at)ericsson(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: ERROR: cache lookup failed for type 0
Date: 2007-05-25 23:38:11
Message-ID: 28163.1180136291@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Michael Harris \(BR/EPA\)" <michael(dot)harris(at)ericsson(dot)com> writes:
> None of the typeid atttypid fields were 0:

Hmm, but you've got a couple of bigint-array columns:

> 167581 | pmtransmittedcarrierpower | 1016 | -1 |
> -1 | 4 | 0 | -1 | -1 | f | x
> | d | f | f | f | f |
> 1
> 167581 | pmaveragerssi | 1016 | -1 |
> -1 | 5 | 0 | -1 | -1 | f | x
> | d | f | f | f | f |
> 1

So that leads to a theory I didn't think of before, which is that this
is not catalog corruption but data corruption. Array values include the
type OID of their elements (to allow a single array_out function to
print the contents of any array value). If you had a row in which one
of these fields had got zeroed out somehow, the error would be
explainable.

> What does "ERROR: cache lookup failed for type 0" mean?

It means some bit of code tried to look up a pg_type entry for type OID 0,
which can't possibly be a valid type OID. So wherever the bit of code
got that OID from is corrupted.

You could possibly learn a bit more by doing "\set VERBOSITY verbose"
in psql before provoking the error; that would tell you exactly which
bit of code is trying to look up the bad OID. Using gdb to get a stack
trace from the errfinish call would be even more informative, if you
have a debug-enabled build. But I suspect at this point that it's a
corrupt-data problem and you should attack it on the basis of figuring
out just which row contains the bad value, so you can fix or delete it.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Harris (BR/EPA) 2007-05-26 01:09:20 Re: ERROR: cache lookup failed for type 0
Previous Message Michael Harris (BR/EPA) 2007-05-25 23:26:50 Re: ERROR: cache lookup failed for type 0