Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WrWhf-0001f8-2l for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Jun 2014 18:11:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WrWhe-0006e5-H8 for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Jun 2014 18:11:22 +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 1WrWhd-0006ch-QE for pgsql-bugs@postgresql.org; Mon, 02 Jun 2014 18:11:21 +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 1WrWha-0006Ag-FX for pgsql-bugs@postgresql.org; Mon, 02 Jun 2014 18:11:20 +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 s52IB9Rh017971; Mon, 2 Jun 2014 14:11:09 -0400 From: Tom Lane To: nicolas@cybercat.ca cc: pgsql-bugs@postgresql.org Subject: Re: BUG #10500: Cannot restore from a dump when some function is used in public shcema In-reply-to: <20140602161427.2797.72238@wrigleys.postgresql.org> References: <20140602161427.2797.72238@wrigleys.postgresql.org> Comments: In-reply-to nicolas@cybercat.ca message dated "Mon, 02 Jun 2014 16:14:27 -0000" Date: Mon, 02 Jun 2014 14:11:09 -0400 Message-ID: <17970.1401732669@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) 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 nicolas@cybercat.ca writes: > I narrow it down to this simple exemple. Here's a pg_dump in plain text of > my test case : > CREATE SCHEMA intranet; > CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public; > SET search_path = public, pg_catalog; > CREATE FUNCTION cyunaccent(character varying) RETURNS character varying > LANGUAGE sql IMMUTABLE > AS $_$ SELECT unaccent(lower($1)); $_$; This function is unsafe on its face: it does not specify what schema to find unaccent() in. You need to either explicitly schema-qualify: SELECT public.unaccent(lower($1)); (for good measure it'd be wise to qualify lower() as well), or else attach a "SET search_path" clause to the function definition. It's arguable whether the search path sensitivity of such functions is a feature or a bug. But there are people depending on the fact that they can change the search path and get different results, so it's unlikely we'd change the definition now. 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