Thread: pg_dump fails with "ERROR: cache lookup failed for index 1531353157"
pg_dump fails with "ERROR: cache lookup failed for index 1531353157"
From
"Benjamin Arai, Ph.D."
Date:
Hello,
The server is still running but pg_dumps output the following error. What should I do?
Thanks,
Benjamin
OUTPUT:
pg_dump: SQL command failed
pg_dump: Error message from server: ERROR: cache lookup failed for index 1531353157
pg_dump: The command was: SELECT t.tableoid, t.oid, t.relname as indexname, pg_catalog.pg_get_indexdef(i.indexrelid) as indexdef, t.relnatts as indnkeys, i.indkey, i.indisclustered, c.contype, c.conname, c.tableoid as contableoid, c.oid as conoid, (SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) as tablespace FROM pg_catalog.pg_index i JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) LEFT JOIN pg_catalog.pg_depend d ON (d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i') LEFT JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) WHERE i.indrelid = '1531340182'::pg_catalog.oid ORDER BY indexname
pg_dump: Error message from server: ERROR: cache lookup failed for index 1531353157
pg_dump: The command was: SELECT t.tableoid, t.oid, t.relname as indexname, pg_catalog.pg_get_indexdef(i.indexrelid) as indexdef, t.relnatts as indnkeys, i.indkey, i.indisclustered, c.contype, c.conname, c.tableoid as contableoid, c.oid as conoid, (SELECT spcname FROM pg_catalog.pg_tablespace s WHERE s.oid = t.reltablespace) as tablespace FROM pg_catalog.pg_index i JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) LEFT JOIN pg_catalog.pg_depend d ON (d.classid = t.tableoid AND d.objid = t.oid AND d.deptype = 'i') LEFT JOIN pg_catalog.pg_constraint c ON (d.refclassid = c.tableoid AND d.refobjid = c.oid) WHERE i.indrelid = '1531340182'::pg_catalog.oid ORDER BY indexname
First thing I would do is checking wether the relation exists (e.g. by checking pg_class for the relfilenode of the relation and then finding it physically in PGDATA folder) or checking wether the file is corrupted for example by finding the name and type of the relation and trying to make some manipulation involving it (e.g. selecting data if it is a table). 2010/9/21 Benjamin Arai, Ph.D. <benjamin@araisoft.com>: > Hello, > > The server is still running but pg_dumps output the following error. What > should I do? > > Thanks, > Benjamin > > OUTPUT: > > pg_dump: SQL command failed > pg_dump: Error message from server: ERROR: cache lookup failed for index > 1531353157 > pg_dump: The command was: SELECT t.tableoid, t.oid, t.relname as indexname, > pg_catalog.pg_get_indexdef(i.indexrelid) as indexdef, t.relnatts as > indnkeys, i.indkey, i.indisclustered, c.contype, c.conname, c.tableoid as > contableoid, c.oid as conoid, (SELECT spcname FROM pg_catalog.pg_tablespace > s WHERE s.oid = t.reltablespace) as tablespace FROM pg_catalog.pg_index i > JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) LEFT JOIN > pg_catalog.pg_depend d ON (d.classid = t.tableoid AND d.objid = t.oid AND > d.deptype = 'i') LEFT JOIN pg_catalog.pg_constraint c ON (d.refclassid = > c.tableoid AND d.refobjid = c.oid) WHERE i.indrelid = > '1531340182'::pg_catalog.oid ORDER BY indexname -- Łukasz Brodziak II MU Bioinformatyka
One solution is to run vacuum and reindex and the db before pg_dump. The second thing to do (it's risky I admit) is to create a file with this name and filling it with zeros. The pg_dump should run without problems. 2010/9/24 Benjamin Arai, Ph.D. <benjamin@araisoft.com>: > The file does not exist. What does that mean? > > > gi000=# select * from pg_class WHERE relfilenode=1531353157; > > relname | relnamespace | reltype | relowner | relam | relfilenode | > reltablespace | relpages | reltuples | reltoastrelid | reltoastidxid | > relhasindex | relisshared | relkind | relnatts | relchecks | reltriggers | > relukeys | relfkeys | relrefs | relhasoids | relhaspkey | relhasrules | > relhassubclass | relacl > > ---------+--------------+---------+----------+-------+-------------+---------------+----------+-----------+---------------+---------------+-------------+-------------+---------+----------+-----------+-------------+----------+----------+---------+------------+------------+-------------+----------------+-------- > > On Thu, Sep 23, 2010 at 2:27 PM, Lukasz Brodziak <lukasz.brodziak@gmail.com> > wrote: >> >> First thing I would do is checking wether the relation exists (e.g. by >> checking pg_class for the relfilenode of the relation and then finding >> it physically in PGDATA folder) or checking wether the file is >> corrupted for example by finding the name and type of the relation and >> trying to make some manipulation involving it (e.g. selecting data if >> it is a table). >> >> 2010/9/21 Benjamin Arai, Ph.D. <benjamin@araisoft.com>: >> > Hello, >> > >> > The server is still running but pg_dumps output the following error. >> > What >> > should I do? >> > >> > Thanks, >> > Benjamin >> > >> > OUTPUT: >> > >> > pg_dump: SQL command failed >> > pg_dump: Error message from server: ERROR: cache lookup failed for >> > index >> > 1531353157 >> > pg_dump: The command was: SELECT t.tableoid, t.oid, t.relname as >> > indexname, >> > pg_catalog.pg_get_indexdef(i.indexrelid) as indexdef, t.relnatts as >> > indnkeys, i.indkey, i.indisclustered, c.contype, c.conname, c.tableoid >> > as >> > contableoid, c.oid as conoid, (SELECT spcname FROM >> > pg_catalog.pg_tablespace >> > s WHERE s.oid = t.reltablespace) as tablespace FROM pg_catalog.pg_index >> > i >> > JOIN pg_catalog.pg_class t ON (t.oid = i.indexrelid) LEFT JOIN >> > pg_catalog.pg_depend d ON (d.classid = t.tableoid AND d.objid = t.oid >> > AND >> > d.deptype = 'i') LEFT JOIN pg_catalog.pg_constraint c ON (d.refclassid = >> > c.tableoid AND d.refobjid = c.oid) WHERE i.indrelid = >> > '1531340182'::pg_catalog.oid ORDER BY indexname >> >> >> >> -- >> Łukasz Brodziak >> II MU Bioinformatyka > > -- Łukasz Brodziak II MU Bioinformatyka