Cache lookup failed for relation X [was: DROP FUNCTION cache lookup failed for relation X]

From: Mark Kirkwood <markir(at)paradise(dot)net(dot)nz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-patches(at)postgresql(dot)org
Subject: Cache lookup failed for relation X [was: DROP FUNCTION cache lookup failed for relation X]
Date: 2007-11-01 08:19:24
Message-ID: 47298C0C.50508@paradise.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
>
> Still in the think-about-it mode, personally ... my proposed fix is
> certainly much too invasive to consider back-patching, so unless someone
> comes up with a way-simpler idea, it's 8.3 material at best ...
>
>
I ran into a variant of this today - simply creating and dropping a
table repeatedly while doing \d from another session:

Session 1:

perl -e 'while (1) {print "drop table if exists z0; \n create table z0
(a int, b int);\n drop table z0;\n"}' | psql cache > z0.log 2>&1

Session 2:

psql cache
=# \d
ERROR: cache lookup failed for relation 945897 (in RelationIsVisible,
namespace.c:406)

The previous discussion centered around working on on locking in
dependency.c whilst dropping related objects - but does this apply when
there is just one? Anyway I tried to understand what was happening and
the attached rather hacky patch seems to cure the behaviour - So I've
submitted it as a discussion aid, rather than 'the way of fixing
this'... since I'm hoping there is a better way :-)

regards

Mark

Attachment Content-Type Size
namspace.c.patch text/x-patch 2.5 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gokulakannan Somasundaram 2007-11-01 10:05:50 Re: Clarification on a Time travel feature
Previous Message Tom Lane 2007-11-01 03:33:46 Re: psql show dbsize?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-11-01 12:08:20 Re: [HACKERS] Cache lookup failed for relation X [was: DROP FUNCTION cache lookup failed for relation X]
Previous Message Pavel Stehule 2007-11-01 06:05:35 actualised czech faq