From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Bruce Momjian <bruce@momjian.us>
Cc: 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)
Date: Wed, 05 Sep 2018 15:03:33 -0400
Message-ID: <12109.1536174213@sss.pgh.pa.us> (raw)
In-Reply-To: <CAPs+M8LYh1fmuU8=yG21nyAuZOOY22EGZsMCwWPH8TLhOqK9tg@mail.gmail.com>
References: <CAPs+M8LCex6d=DeneofdsoJVijaG59m9V0ggbb3pOH7hZO4+cQ@mail.gmail.com>
<20180829190635.GD25450@momjian.us>
<CAPs+M8KRP3McWzVwU1hs9QZXsUHXbb7RSgtshqcy4NwDgW0VHg@mail.gmail.com>
<6c73c320-95b7-c259-e309-c46300557852@aklaver.com>
<CAPs+M8KpVH0mm5N1T7Qf5TiwkSF8se3Aadu3RwDbJZwAexC5zw@mail.gmail.com>
<6e023cde-943a-5cea-8626-f1e9b29695df@aklaver.com>
<CAPs+M8LYh1fmuU8=yG21nyAuZOOY22EGZsMCwWPH8TLhOqK9tg@mail.gmail.com>
Gunnlaugur Thor Briem <gunnlaugur@gmail.com> 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
Attachments:avoid-depending-on-search-path-in-unaccent.patch (text/x-diff, 1.0K) downloaddiff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.cindex 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() == 1)
{
! dictOid = get_ts_dict_oid(stringToQualifiedNameList("unaccent"), false);
strArg = 0;
}
else
--- 377,393 ----
if (PG_NARGS() == 1)
{
! /*
! * Use the "unaccent" dictionary that is in the same schema that this
! * function is in.
! */
! Oid procnspid = get_func_namespace(fcinfo->flinfo->fn_oid);
! char *procnsp = get_namespace_name(procnspid);
! List *dictname;
!
! dictname = list_make2(makeString(procnsp),
! makeString(pstrdup("unaccent")));
! dictOid = get_ts_dict_oid(dictname, false);
strArg = 0;
}
else
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, gunnlaugur@gmail.com, adrian.klaver@aklaver.com, bruce@momjian.us
Subject: Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
In-Reply-To: <12109.1536174213@sss.pgh.pa.us>
References: <CAPs+M8LCex6d=DeneofdsoJVijaG59m9V0ggbb3pOH7hZO4+cQ@mail.gmail.com> <20180829190635.GD25450@momjian.us> <CAPs+M8KRP3McWzVwU1hs9QZXsUHXbb7RSgtshqcy4NwDgW0VHg@mail.gmail.com> <6c73c320-95b7-c259-e309-c46300557852@aklaver.com> <CAPs+M8KpVH0mm5N1T7Qf5TiwkSF8se3Aadu3RwDbJZwAexC5zw@mail.gmail.com> <6e023cde-943a-5cea-8626-f1e9b29695df@aklaver.com> <CAPs+M8LYh1fmuU8=yG21nyAuZOOY22EGZsMCwWPH8TLhOqK9tg@mail.gmail.com> <12109.1536174213@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox