Thread: BUG #16932: Database Crash with : ERROR: cache lookup failed for type 0

BUG #16932: Database Crash with : ERROR: cache lookup failed for type 0

From
PG Bug reporting form
Date:
The following bug has been logged on the website:

Bug reference:      16932
Logged by:          Vlad
Email address:      github@vlqubed.com
PostgreSQL version: 10.11
Operating system:   Windows
Description:

The database is running on Azure (postgres as a service)
    select version():   PostgreSQL 10.11, compiled by Visual C++ build 1800,
64-bit

We have also seen this error on an 11.6 version of the database.

We have a nightly process which builds a set of tables with static data for
reporting purposes.

Randomly, we see this error in the logs:

2021-03-18 07:52:32 UTC-6052fa73.12638-ERROR:  cache lookup failed for type
0
...
then database crashes, then new log file:
...
2021-03-18 07:55:58 UTC-60530700.18-LOG:  could not bind socket for
statistics collector: A socket operation was attempted to an unreachable
host.

    
2021-03-18 07:55:58 UTC-60530700.18-LOG:  trying another address for the
statistics collector
2021-03-18 07:55:59 UTC-6053078f.24-LOG:  database system was interrupted;
last known up at 2021-03-18 07:47:04 UTC
2021-03-18 07:56:00 UTC-6053078f.24-LOG:  database system was not properly
shut down; automatic recovery in progress


Our process is as follows ( pseudo code simplified ):
begin trans;
call a procedure that drops and re-creates a table.
commit;

begin trans
loop 1000 rows
   insert into table above....
end loop;
commit;

when the error occurs, it always occurs on inserting the first row into the
new table;

Re-running the above usually succeeds the second try.


PG Bug reporting form <noreply@postgresql.org> writes:
> Randomly, we see this error in the logs:
> 2021-03-18 07:52:32 UTC-6052fa73.12638-ERROR:  cache lookup failed for type
> 0

> Our process is as follows ( pseudo code simplified ):
> begin trans;
> call a procedure that drops and re-creates a table.
> commit;

> begin trans
> loop 1000 rows
>    insert into table above....
> end loop;
> commit;

Hm.  Can you provide a self-contained test case?

It'd also be worth your time to update to latest 10.x, in case this is
an already-fixed bug.  A quick trawl of the commit logs didn't turn up
an obvious match, but I might have missed a relevant fix.

https://wiki.postgresql.org/wiki/Guide_to_reporting_problems

            regards, tom lane