Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxd5b-0002qg-Cz for pgsql-general@arkaria.postgresql.org; Wed, 05 Sep 2018 19:03:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fxd5Y-0004Ba-Nc for pgsql-general@arkaria.postgresql.org; Wed, 05 Sep 2018 19:03:40 +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.89) (envelope-from ) id 1fxd5Y-0004BT-Cp for pgsql-general@lists.postgresql.org; Wed, 05 Sep 2018 19:03:40 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fxd5V-0002W0-RS for pgsql-general@lists.postgresql.org; Wed, 05 Sep 2018 19:03:39 +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 w85J3Xr7012110; Wed, 5 Sep 2018 15:03:33 -0400 From: Tom Lane To: Gunnlaugur Thor Briem cc: Adrian Klaver , Bruce Momjian , pgsql-general@lists.postgresql.org Subject: Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) In-reply-to: References: <20180829190635.GD25450@momjian.us> <6c73c320-95b7-c259-e309-c46300557852@aklaver.com> <6e023cde-943a-5cea-8626-f1e9b29695df@aklaver.com> Comments: In-reply-to Gunnlaugur Thor Briem message dated "Wed, 05 Sep 2018 08:49:50 -0000" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <12058.1536174163.0@sss.pgh.pa.us> Date: Wed, 05 Sep 2018 15:03:33 -0400 Message-ID: <12109.1536174213@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12058.1536174163.1@sss.pgh.pa.us> Gunnlaugur Thor Briem writes: > SET search_path = "$user"; SELECT public.unaccent('foo'); > SET > ERROR: text search dictionary "unaccent" does not exist Meh. I think we need the attached, or something just about like it. It's barely possible that there's somebody out there who's relying on setting the search path to allow choosing among multiple "unaccent" dictionaries. But there are way more people whose functions are broken due to the recent search-path-tightening changes. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="avoid-depending-on-search-path-in-unaccent.patch"; charset="us-ascii" Content-ID: <12058.1536174163.2@sss.pgh.pa.us> Content-Description: avoid-depending-on-search-path-in-unaccent.patch Content-Transfer-Encoding: quoted-printable diff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.c index 247c202..5f6ad8a 100644 *** a/contrib/unaccent/unaccent.c --- b/contrib/unaccent/unaccent.c *************** *** 20,25 **** --- 20,26 ---- #include "tsearch/ts_locale.h" #include "tsearch/ts_public.h" #include "utils/builtins.h" + #include "utils/lsyscache.h" #include "utils/regproc.h" = PG_MODULE_MAGIC; *************** unaccent_dict(PG_FUNCTION_ARGS) *** 376,382 **** = if (PG_NARGS() =3D=3D 1) { ! dictOid =3D get_ts_dict_oid(stringToQualifiedNameList("unaccent"), fal= se); strArg =3D 0; } else --- 377,393 ---- = if (PG_NARGS() =3D=3D 1) { ! /* ! * Use the "unaccent" dictionary that is in the same schema that this ! * function is in. ! */ ! Oid procnspid =3D get_func_namespace(fcinfo->flinfo->fn_oid); ! char *procnsp =3D get_namespace_name(procnspid); ! List *dictname; ! = ! dictname =3D list_make2(makeString(procnsp), ! makeString(pstrdup("unaccent"))); ! dictOid =3D get_ts_dict_oid(dictname, false); strArg =3D 0; } else ------- =_aaaaaaaaaa0--