Re: [BUGS] BUG #14659: "ERROR: could not open relation with OID" when creating table from SELECT with large row - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] BUG #14659: "ERROR: could not open relation with OID" when creating table from SELECT with large row
Date
Msg-id 21218.1495120309@sss.pgh.pa.us
Whole thread Raw
In response to [BUGS] BUG #14659: "ERROR: could not open relation with OID" when creatingtable from SELECT with large row  (kwan.lim@gmail.com)
List pgsql-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

pgsql-bugs by date:

Previous
From: kwan.lim@gmail.com
Date:
Subject: [BUGS] BUG #14659: "ERROR: could not open relation with OID" when creatingtable from SELECT with large row
Next
From: tbrandys@webcellence.com
Date:
Subject: [BUGS] BUG #14660: Conversion to UTC not properly computed