From: Tom Lane <tgl@sss.pgh.pa.us>
To: lifeair@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6707: ERROR: could not open relation with OID
Date: Tue, 26 Jun 2012 23:51:14 -0400
Message-ID: <20285.1340769074@sss.pgh.pa.us> (raw)
In-Reply-To: <E1SjXrM-000119-Vk@wrigleys.postgresql.org>
References: <E1SjXrM-000119-Vk@wrigleys.postgresql.org>
lifeair@gmail.com writes:
> CREATE OR REPLACE FUNCTION test() RETURNS integer AS
> $BODY$
> DECLARE
> _r RECORD;
> BEGIN
> CREATE TEMP TABLE test(id int);
> _r := ROW(NULL)::test;
> _r:=NULL;
> DROP TABLE test CASCADE;
> RETURN 1;
> END;
> $BODY$
> LANGUAGE plpgsql VOLATILE
> COST 100;
Hmm. The problem with this is that the DROP TABLE invalidates test's
rowtype, so on a second call the already-compiled "ROW(NULL)::test"
expression refers to a type that no longer exists.
We could fix that by adding datatypes to the set of objects that are
tracked to determine when a cached plan must be invalidated, but I'm
more than a bit hesitant to expend the extra cycles for this, given
the lack of previous complaints and the large number of datatypes
that are mentioned in most plans.
Perhaps it would be good enough to only track types that must be
rowtypes (ie, are mentioned in RowExpr or ConvertRowtypeExpr)?
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, lifeair@gmail.com
Subject: Re: BUG #6707: ERROR: could not open relation with OID
In-Reply-To: <20285.1340769074@sss.pgh.pa.us>
References: <E1SjXrM-000119-Vk@wrigleys.postgresql.org> <20285.1340769074@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox