Re: \d t: ERROR: XX000: cache lookup failed for relation
| От | Teodor Sigaev |
|---|---|
| Тема | Re: \d t: ERROR: XX000: cache lookup failed for relation |
| Дата | |
| Msg-id | b3c77922-f346-768e-03b7-bf8f0777bc37@sigaev.ru обсуждение исходный текст |
| Ответ на | Re: \d t: ERROR: XX000: cache lookup failed for relation (Teodor Sigaev <teodor@sigaev.ru>) |
| Список | 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/
Вложения
В списке pgsql-hackers по дате отправления: