Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eciMk-00068K-Cz for pgsql-general@arkaria.postgresql.org; Sat, 20 Jan 2018 01:54:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eciMj-0004n9-JZ for pgsql-general@arkaria.postgresql.org; Sat, 20 Jan 2018 01:54:41 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eciMj-0004mz-8L for pgsql-general@lists.postgresql.org; Sat, 20 Jan 2018 01:54:41 +0000 Received: from n3.nabble.com ([162.255.23.22]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1eciMf-0000Fa-KN for pgsql-general@postgresql.org; Sat, 20 Jan 2018 01:54:39 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id DE65EABA841D for ; Fri, 19 Jan 2018 18:54:34 -0700 (MST) Date: Fri, 19 Jan 2018 18:54:34 -0700 (MST) From: pinker To: pgsql-general@postgresql.org Message-ID: <1516413274908-0.post@n3.nabble.com> In-Reply-To: <23105.1509594355@sss.pgh.pa.us> References: <20171101220354.GB22239@telsasoft.com> <13901.1509586595@sss.pgh.pa.us> <21716.1509592353@sss.pgh.pa.us> <23105.1509594355@sss.pgh.pa.us> Subject: Re: Possible bug: could not open relation with OID [numbers] SQL State: XX000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_321146_89219618.1516413274908" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_321146_89219618.1516413274908 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit I would like to refresh the topic and add another report about the issue that just happened to me.I'm sure it's the toast table that cannot be opened inside the function.I have added following RAISE NOTICE clauses to it and run analyze inside of the function: analyze verbose temp_table; raise notice 'oid temp_table %', ( SELECT array_agg(relname::TEXT|| relfilenode::TEXT|| 'relpages:'||relpages::TEXT|| 'reltuples:' || reltuples::TEXT|| 'relallvisible:' ||relallvisible::TEXT||'reltoastrelid:'|| reltoastrelid::TEXT) FROM pg_class where relname= 'temp_table'); raise notice 'rel size %', (select pg_total_relation_size('temp_table')); It's pointing to the toast table: 1 live rows and 1 dead rows; 1 rows in sample, 1 estimated total rowspsql:/tmp/gg:23: NOTICE: oid temp_table {temp_table106538relpages:1reltuples:1relallvisible:0reltoastrelid:*106541*}psql:/tmp/gg:23: NOTICE: rel size 32768psql:/tmp/gg:23: ERROR: could not open relation with OID *106541* Thank you for the advice about ON COMMIT DROP - it's working.When the table size is smaller, about 16k this issue simply disappears. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html ------=_Part_321146_89219618.1516413274908 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit I would like to refresh the topic and add another report about the issue that just happened to me. I'm sure it's the toast table that cannot be opened inside the function. I have added following RAISE NOTICE clauses to it and run analyze inside of the function:
    analyze verbose temp_table; 
raise notice 'oid temp_table %', ( SELECT array_agg(relname::TEXT|| relfilenode::TEXT|| 'relpages:'||relpages::TEXT|| 'reltuples:' || reltuples::TEXT|| 'relallvisible:' ||relallvisible::TEXT||'reltoastrelid:'|| reltoastrelid::TEXT) FROM pg_class where relname= 'temp_table');
raise notice 'rel size %', (select pg_total_relation_size('temp_table'));
It's pointing to the toast table:
1 live rows and 1 dead rows; 1 rows in sample, 1 estimated total rows
psql:/tmp/gg:23: NOTICE:  oid temp_table {temp_table106538relpages:1reltuples:1relallvisible:0reltoastrelid:106541}
psql:/tmp/gg:23: NOTICE:  rel size 32768

psql:/tmp/gg:23: ERROR:  could not open relation with OID 106541
Thank you for the advice about ON COMMIT DROP - it's working. When the table size is smaller, about 16k this issue simply disappears.

Sent from the PostgreSQL - general mailing list archive at Nabble.com.
------=_Part_321146_89219618.1516413274908--