pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #6707: ERROR: could not open relation with OID
3+ messages / 3 participants
[nested] [flat]

* BUG #6707: ERROR: could not open relation with OID
@ 2012-06-26 15:39 lifeair@gmail.com
  2012-06-27 03:51 ` Re: BUG #6707: ERROR: could not open relation with OID Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: lifeair@gmail.com @ 2012-06-26 15:39 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      6707
Logged by:          LiFeAiR
Email address:      lifeair@gmail.com
PostgreSQL version: 9.1.4
Operating system:   FREE BSD
Description:        

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;

  select test();




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6707: ERROR: could not open relation with OID
  2012-06-26 15:39 BUG #6707: ERROR: could not open relation with OID lifeair@gmail.com
@ 2012-06-27 03:51 ` Tom Lane <tgl@sss.pgh.pa.us>
  2012-07-02 02:59   ` Re: BUG #6707: ERROR: could not open relation with OID Greg Sabino Mullane <greg@turnstep.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2012-06-27 03:51 UTC (permalink / raw)
  To: lifeair@gmail.com; +Cc: pgsql-bugs

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #6707: ERROR: could not open relation with OID
  2012-06-26 15:39 BUG #6707: ERROR: could not open relation with OID lifeair@gmail.com
  2012-06-27 03:51 ` Re: BUG #6707: ERROR: could not open relation with OID Tom Lane <tgl@sss.pgh.pa.us>
@ 2012-07-02 02:59   ` Greg Sabino Mullane <greg@turnstep.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Greg Sabino Mullane @ 2012-07-02 02:59 UTC (permalink / raw)
  To: pgsql-bugs


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


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.

re previous complaints:

I've run across this in the past but just chalked it up to a 
"guess Postgres doesn't like it done that way". I suspect there may 
be others in the same boat?

> Perhaps it would be good enough to only track types that must be
> rowtypes (ie, are mentioned in RowExpr or ConvertRowtypeExpr)?

+1

- -- 
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 201207012259
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAk/xDoYACgkQvJuQZxSWSsiFJwCfQBqt/SUkFHeA8FP+mq3nKtW6
GFwAnjx7WVlCCws7XdsQYDOVYzzpC8iW
=q158
-----END PGP SIGNATURE-----





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2012-07-02 02:59 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2012-06-26 15:39 BUG #6707: ERROR: could not open relation with OID lifeair@gmail.com
2012-06-27 03:51 ` Tom Lane <tgl@sss.pgh.pa.us>
2012-07-02 02:59   ` Greg Sabino Mullane <greg@turnstep.com>

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