Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YJBIo-000795-Do for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Feb 2015 01:32:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YJBIn-0006rW-R6 for pgsql-bugs@arkaria.postgresql.org; Thu, 05 Feb 2015 01:32:17 +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 1YJBIm-0006rP-U8 for pgsql-bugs@postgresql.org; Thu, 05 Feb 2015 01:32:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YJBIj-0001Ij-GZ for pgsql-bugs@postgresql.org; Thu, 05 Feb 2015 01:32:15 +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 t151WBOx018196; Wed, 4 Feb 2015 20:32:11 -0500 From: Tom Lane To: Elijah Zupancic cc: pgsql-bugs@postgresql.org Subject: Re: pg_dump search path issue In-reply-to: References: Comments: In-reply-to Elijah Zupancic message dated "Wed, 04 Feb 2015 16:08:07 -0800" Date: Wed, 04 Feb 2015 20:32:11 -0500 Message-ID: <18195.1423099931@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 Elijah Zupancic writes: > In the SQL dump, you will notice that the SET search_path = xxx values > will often not include the public schema which holds the functions > needed to properly recreate tables that depend on extensions. All the cases I've seen of this involve user-defined functions that are broken, often dangerously so. A function should not assume that it's being called with any particular search_path; if it's intended for use in a multi-schema database, good practice is to either explicitly qualify names or use a SET clause to force the search_path to be what it expects. > It seems like the code that generates the SET search_path should check > to see if any of the objects it is dumping depend on functions that > use the public schema. If that didn't involve solving the halting problem, we might try to do it. But for better or worse, functions in Postgres are mostly black boxes so far as callers are concerned. It's not possible for pg_dump to know that some function has an expectation of being invoked with a particular search path. 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