pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: kwan.lim@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14659: "ERROR: could not open relation with OID" when creating table from SELECT with large row
Date: Thu, 18 May 2017 11:11:49 -0400
Message-ID: <21218.1495120309@sss.pgh.pa.us> (raw)
In-Reply-To: <20170518142443.29045.69550@wrigleys.postgresql.org>
References: <20170518142443.29045.69550@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

kwan.lim@gmail.com writes:
> We have a UDF that creates a temporary table from a SELECT statement then
> returns the result and drops the table.
> For certain cases where it appears that there are large strings in some
> columns the UDF fails with: "ERROR: could not open relation with OID"

What seems to be happening is that if the strings are large enough to be
toasted, then the data returned out of the function with RETURN QUERY
contains toast pointers referencing the temp table's toast table.
If you drop the temp table then those pointers will fail upon use.

In this particular example there's an obvious workaround: lose the final
DROP TABLE.  The function's initial "DROP IF EXISTS" will serve just fine.

It seems like what we'd have to do to fix this is to detoast datums
that are going into the returned tuplestore.  That's pretty annoying
from a performance standpoint, but I don't see any good alternative.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <21218.1495120309@sss.pgh.pa.us>
Permalink:  ../21218.1495120309@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21218.1495120309@sss.pgh.pa.us

 · 

reply

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, kwan.lim@gmail.com
  Subject: Re: BUG #14659: "ERROR: could not open relation with OID" when creating table from SELECT with large row
  In-Reply-To: <21218.1495120309@sss.pgh.pa.us>
  References: <20170518142443.29045.69550@wrigleys.postgresql.org> <21218.1495120309@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