Re: "Relation x does not exist" error when x does exist

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gaurav Priyolkar <gaurav_lists(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: "Relation x does not exist" error when x does exist
Date: 2001-10-12 18:12:16
Message-ID: 27705.1002910336@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Gaurav Priyolkar <gaurav_lists(at)yahoo(dot)com> writes:
> So as you can see, I get a "relation does not exist" error on a
> function that is very much there.=20

It's not there at the point of the failure, though. Your observation
that foo_1 is still there is made after rolling back the drop and
recreate of foo_1.

The reason there's an issue is that plpgsql caches a query plan for the
"SELECT x FROM foo_1" query, and that plan is no good after you drop the
original version of foo_1; but we don't currently have a mechanism to
invalidate the cached plan.

Workarounds: (1) use EXECUTE to avoid caching a plan for the problem
queries; (2) instead of DROP/CREATE, consider DELETE FROM/INSERT INTO
(or perhaps TRUNCATE instead of DELETE, although TRUNCATE can't be
rolled back).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-10-12 18:13:19 Re: Another episode of the regular MySql-PostgreSQL war
Previous Message Bruce Momjian 2001-10-12 18:11:33 Re: Joining Between Databases