Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eA4R0-0005NI-Pu for pgsql-general@arkaria.postgresql.org; Thu, 02 Nov 2017 01:36:42 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eA4R0-0003QJ-6G for pgsql-general@arkaria.postgresql.org; Thu, 02 Nov 2017 01:36:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eA4Qz-0003PP-AW for pgsql-general@postgresql.org; Thu, 02 Nov 2017 01:36:41 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eA4Qw-0001Vb-AJ for pgsql-general@postgresql.org; Thu, 02 Nov 2017 01:36:40 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vA21aZ6R013902; Wed, 1 Nov 2017 21:36:35 -0400 From: Tom Lane To: Adam Brusselback cc: Justin Pryzby , "pgsql-general@postgresql.org" Subject: Re: Possible bug: could not open relation with OID [numbers] SQL State: XX000 In-reply-to: References: <20171101220354.GB22239@telsasoft.com> Comments: In-reply-to Adam Brusselback message dated "Wed, 01 Nov 2017 19:30:04 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <13900.1509586595.1@sss.pgh.pa.us> Date: Wed, 01 Nov 2017 21:36:35 -0400 Message-ID: <13901.1509586595@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Adam Brusselback writes: > The OID does not match any of the temp tables, so not sure what's up there. > I have the function RETURN QUERY, > and then I drop all my temp tables. I'll bet the OID corresponds to the toast table for one of those temp tables. RETURN QUERY will stash away all the values read by the query, but it doesn't make an attempt to inline out-of-line values; so you get a failure when the out-of-line column value is eventually demanded. I think we've seen one previous complaint of the same ilk. Probably somebody will get annoyed enough to fix it at some point, but the sticking point is how to cover this corner case without causing a performance drop for normal cases. In the meantime, maybe you could make the temp tables be ON COMMIT DROP instead of dropping them explicitly mid-transaction. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general