Re: \d t: ERROR: XX000: cache lookup failed for relation - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: \d t: ERROR: XX000: cache lookup failed for relation
Date
Msg-id b3c77922-f346-768e-03b7-bf8f0777bc37@sigaev.ru
Whole thread Raw
In response to Re: \d t: ERROR: XX000: cache lookup failed for relation  (Teodor Sigaev <teodor@sigaev.ru>)
List pgsql-hackers

Teodor Sigaev wrote:
>> Ah, I think this is the missing, essential component:
>> CREATE INDEX ON t(right(i::text,1)) WHERE i::text LIKE '%1';
> Finally, I reproduce it with attached script.
In attachment simplified version of script. psql uses ordinary sql query 
to get info about index with usual transaction isolation/MVCC. To create 
a description of index it calls pg_get_indexdef() which doesn't use 
transaction snapshot, it uses catalog snapshot because it accesses to 
catalog through system catalog cache. So the difference is used snapshot 
  between ordinary SQL query and  pg_get_indexdef(). I'm not sure that 
easy to fix and should it be fixed at all.

Simplified query:
SELECT c2.relname, i.indexrelid,
    pg_catalog.pg_get_indexdef(i.indexrelid, 0, true)
FROM pg_catalog.pg_class c, pg_catalog.pg_class c2,
    pg_catalog.pg_index i
WHERE c.relname = 't' AND c.oid = i.indrelid AND i.indexrelid = c2.oid
-- 
Teodor Sigaev                      E-mail: teodor@sigaev.ru
                                       WWW: http://www.sigaev.ru/

Attachment

pgsql-hackers by date:

Previous
From: Andrew Gierth
Date:
Subject: Re: [PATCH] Trim trailing whitespace in vim and emacs
Next
From: Michael Paquier
Date:
Subject: Re: commitfest 2018-07