Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YTSdW-00035s-Cb for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Mar 2015 10:04:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YTSdV-0003cy-Oi for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Mar 2015 10:04:09 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YTSdU-0003b3-Lc for pgsql-bugs@postgresql.org; Thu, 05 Mar 2015 10:04:08 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YTSdP-00023D-Mt for pgsql-bugs@postgresql.org; Thu, 05 Mar 2015 10:04:06 +0000 MIME-Version: 1.0 Subject: BUG #12832: pg_dump ERROR with temporary functions To: pgsql-bugs@postgresql.org From: marko@joh.to Date: Thu, 05 Mar 2015 10:03:43 +0000 Message-ID: <20150305100343.2527.9521@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 12832 Logged by: Marko Tiikkaja Email address: marko@joh.to PostgreSQL version: 9.3.6 Operating system: Linux Description: Hi, We've occasionally been having a problem where a script does roughly this: psql -d dbname -c "CREATE TEMPORARY FUNCTION pg_temp.foo() AS ..; " pg_dump -d dbname And the pg_dump call ERRORs out like this: pg_dump: [archiver (db)] query failed: ERROR: cache lookup failed for function 2540046 pg_dump: [archiver (db)] query was: SELECT tableoid, oid, proname, prolang, pronargs, proargtypes, prorettype, proacl, pronamespace, pg_catalog.pg_get_function_identity_arguments(oid) AS proiargs,(SELECT rolname FROM pg_catalog.pg_roles WHERE oid = proowner) AS rolname FROM pg_proc p WHERE NOT proisagg AND (pronamespace != (SELECT oid FROM pg_namespace WHERE nspname = 'pg_catalog') AND NOT EXISTS (SELECT 1 FROM pg_depend WHERE classid = 'pg_proc'::regclass AND objid = p.oid AND deptype = 'i')) The problem seems to be that the snapshot of pg_proc the pg_dump session has sees the function, but by the time it gets to run pg_get_function_identity_arguments() on it, it's been cleaned up by the backend which created it. Now this is an issue with normal functions as well if they're dropped concurrently with a pg_dump run, but running into problems like this when doing everything sequentially seems more astonishing to my little brain. Any thoughts on adding NOT pg_is_other_temp_schema(pg_proc.pronamespace) quals to the queries which look at pg_proc to counter this problem? Obviously this can be worked around in client code with a strategically placed DISCARD TEMP, but in general this seems like a POLA violation. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs