pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
9+ messages / 4 participants
[nested] [flat]

* unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
@ 2018-09-05 08:49 Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 14:00 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Adrian Klaver <adrian.klaver@aklaver.com>
  2018-09-05 19:03 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 9+ messages in thread

From: Gunnlaugur Thor Briem @ 2018-09-05 08:49 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-general@lists.postgresql.org

OK, I found the cause of the unaccent dictionary problem, and a workaround.

It's not the vacuumdb version, not the unaccent version, and it's not even
a pg_upgrade problem: I get this error also with PG 9.4.18 running on the
old cluster, with both the 10.5 vacuumdb and the 9.4.18 vacuumdb, and I get
the same error in both.

And it's not strictly a vacuumdb problem, though vacuumdb triggers it.

Here's a very minimal test case, unrelated to my DB, that you ought to be
able to reproduce:

SET search_path = "$user"; SELECT public.unaccent('fóö');
SET
ERROR:  text search dictionary "unaccent" does not exist

and here's a workaround:

SET search_path = "$user"; SELECT public.unaccent(tsdict.oid, 'fóö')
FROM pg_catalog.pg_ts_dict tsdict WHERE dictname='unaccent';
SET
 unaccent
----------
 foo
(1 row)

The workaround avoids the OID lookup of the dictionary ... that lookup (in
the single-argument unaccent function) is done by unqualified name:

https://github.com/postgres/postgres/blob/fb8697b31aaeebe6170c572739867dcaa01053c6/contrib/unaccent/...

        dictOid = get_ts_dict_oid(stringToQualifiedNameList("unaccent"),
false);

and that fails if the search path doesn't include public.

So it is indeed triggered by the security changes that Bruce mentioned;
those were backported into 9.4.17:
https://www.postgresql.org/docs/9.4/static/release-9-4-17.html ... and so
got pulled in by my Macports upgrades. So nothing to do with pg_upgrade.

So the workaround for my vacuumdb/function-index problem is to give
unaccent the OID of the text search dictionary, so that the search path
isn't in play:

CREATE OR REPLACE FUNCTION public.semantic_normalize(title text)
RETURNS text
 LANGUAGE sql
 IMMUTABLE STRICT
AS $function$
  SELECT lower(public.unaccent(16603, btrim(regexp_replace($1, '\s+', ' ',
'g'), ' "')))
$function$;

and that makes vacuumdb -z work in both 9.4.18 and 10.5, and makes
./analyze_new_cluster.sh complete without problems.

The proper fix is, I suppose, to make the single-argument unaccent function
explicitly look up the dictionary in the same schema as the function itself
is in.

Cheers,
Gulli

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
@ 2018-09-05 14:00 ` Adrian Klaver <adrian.klaver@aklaver.com>
  2018-09-05 14:06   ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  1 sibling, 1 reply; 9+ messages in thread

From: Adrian Klaver @ 2018-09-05 14:00 UTC (permalink / raw)
  To: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-general@lists.postgresql.org

On 09/05/2018 01:49 AM, Gunnlaugur Thor Briem wrote:
> OK, I found the cause of the unaccent dictionary problem, and a workaround.
> 
> It's not the vacuumdb version, not the unaccent version, and it's not 
> even a pg_upgrade problem: I get this error also with PG 9.4.18 running 
> on the old cluster, with both the 10.5 vacuumdb and the 9.4.18 vacuumdb, 
> and I get the same error in both.
> 
> And it's not strictly a vacuumdb problem, though vacuumdb triggers it.
> 
> Here's a very minimal test case, unrelated to my DB, that you ought to 
> be able to reproduce:
> 
> SET search_path = "$user"; SELECT public.unaccent('fóö');
> SET
> ERROR:  text search dictionary "unaccent" does not exist
> 
> and here's a workaround:
> 
> SET search_path = "$user"; SELECT public.unaccent(tsdict.oid, 'fóö')
> FROM pg_catalog.pg_ts_dict tsdict WHERE dictname='unaccent';
> SET
>   unaccent
> ----------
>   foo
> (1 row)
> 
> The workaround avoids the OID lookup of the dictionary ... that lookup 
> (in the single-argument unaccent function) is done by unqualified name:
> 
> https://github.com/postgres/postgres/blob/fb8697b31aaeebe6170c572739867dcaa01053c6/contrib/unaccent/...
> 
>          dictOid = 
> get_ts_dict_oid(stringToQualifiedNameList("unaccent"), false);
> 
> and that fails if the search path doesn't include public. >
> So it is indeed triggered by the security changes that Bruce mentioned; 
> those were backported into 9.4.17: 
> https://www.postgresql.org/docs/9.4/static/release-9-4-17.html ... and 
> so got pulled in by my Macports upgrades. So nothing to do with pg_upgrade.
> 
> So the workaround for my vacuumdb/function-index problem is to give 
> unaccent the OID of the text search dictionary, so that the search path 
> isn't in play:
> 
> CREATE OR REPLACE FUNCTION public.semantic_normalize(title text)
> RETURNS text
>   LANGUAGE sql
>   IMMUTABLE STRICT
> AS $function$
>    SELECT lower(public.unaccent(16603, btrim(regexp_replace($1, '\s+', ' 
> ', 'g'), ' "')))
> $function$;
> 
> and that makes vacuumdb -z work in both 9.4.18 and 10.5, and makes 
> ./analyze_new_cluster.sh complete without problems.


Nice investigation. Working off the above, I offer a suggestion:

SET search_path = "$user"; SELECT public.unaccent('unaccent', 'fóö');
SET
ERROR:  text search dictionary "unaccent" does not exist
LINE 1: SELECT public.unaccent('unaccent', 'fóö');


SET search_path = "$user"; SELECT public.unaccent('public.unaccent', 'fóö');
SET
  unaccent
----------
  foo

That eliminates hard wiring the OID.

> 
> The proper fix is, I suppose, to make the single-argument unaccent 
> function explicitly look up the dictionary in the same schema as the 
> function itself is in.
> 
> Cheers,
> Gulli
> 


-- 
Adrian Klaver
adrian.klaver@aklaver.com




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 14:00 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Adrian Klaver <adrian.klaver@aklaver.com>
@ 2018-09-05 14:06   ` Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Gunnlaugur Thor Briem @ 2018-09-05 14:06 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-general@lists.postgresql.org

Yep, a neater workaround for sure!

Cheers,
Gulli

On Wed, Sep 5, 2018 at 2:00 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 09/05/2018 01:49 AM, Gunnlaugur Thor Briem wrote:
> > OK, I found the cause of the unaccent dictionary problem, and a
> workaround.
> >
> > It's not the vacuumdb version, not the unaccent version, and it's not
> > even a pg_upgrade problem: I get this error also with PG 9.4.18 running
> > on the old cluster, with both the 10.5 vacuumdb and the 9.4.18 vacuumdb,
> > and I get the same error in both.
> >
> > And it's not strictly a vacuumdb problem, though vacuumdb triggers it.
> >
> > Here's a very minimal test case, unrelated to my DB, that you ought to
> > be able to reproduce:
> >
> > SET search_path = "$user"; SELECT public.unaccent('fóö');
> > SET
> > ERROR:  text search dictionary "unaccent" does not exist
> >
> > and here's a workaround:
> >
> > SET search_path = "$user"; SELECT public.unaccent(tsdict.oid, 'fóö')
> > FROM pg_catalog.pg_ts_dict tsdict WHERE dictname='unaccent';
> > SET
> >   unaccent
> > ----------
> >   foo
> > (1 row)
> >
> > The workaround avoids the OID lookup of the dictionary ... that lookup
> > (in the single-argument unaccent function) is done by unqualified name:
> >
> >
> https://github.com/postgres/postgres/blob/fb8697b31aaeebe6170c572739867dcaa01053c6/contrib/unaccent/...
> >
> >          dictOid =
> > get_ts_dict_oid(stringToQualifiedNameList("unaccent"), false);
> >
> > and that fails if the search path doesn't include public. >
> > So it is indeed triggered by the security changes that Bruce mentioned;
> > those were backported into 9.4.17:
> > https://www.postgresql.org/docs/9.4/static/release-9-4-17.html ... and
> > so got pulled in by my Macports upgrades. So nothing to do with
> pg_upgrade.
> >
> > So the workaround for my vacuumdb/function-index problem is to give
> > unaccent the OID of the text search dictionary, so that the search path
> > isn't in play:
> >
> > CREATE OR REPLACE FUNCTION public.semantic_normalize(title text)
> > RETURNS text
> >   LANGUAGE sql
> >   IMMUTABLE STRICT
> > AS $function$
> >    SELECT lower(public.unaccent(16603, btrim(regexp_replace($1, '\s+', '
> > ', 'g'), ' "')))
> > $function$;
> >
> > and that makes vacuumdb -z work in both 9.4.18 and 10.5, and makes
> > ./analyze_new_cluster.sh complete without problems.
>
>
> Nice investigation. Working off the above, I offer a suggestion:
>
> SET search_path = "$user"; SELECT public.unaccent('unaccent', 'fóö');
> SET
> ERROR:  text search dictionary "unaccent" does not exist
> LINE 1: SELECT public.unaccent('unaccent', 'fóö');
>
>
> SET search_path = "$user"; SELECT public.unaccent('public.unaccent',
> 'fóö');
> SET
>   unaccent
> ----------
>   foo
>
> That eliminates hard wiring the OID.
>
> >
> > The proper fix is, I suppose, to make the single-argument unaccent
> > function explicitly look up the dictionary in the same schema as the
> > function itself is in.
> >
> > Cheers,
> > Gulli
> >
>
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
@ 2018-09-05 19:03 ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-05 22:37   ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 9+ messages in thread

From: Tom Lane @ 2018-09-05 19:03 UTC (permalink / raw)
  To: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; Bruce Momjian <bruce@momjian.us>; pgsql-general@lists.postgresql.org

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) download 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() == 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
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 19:03 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-09-05 22:37   ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-07 22:32     ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2018-09-05 22:37 UTC (permalink / raw)
  To: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; Bruce Momjian <bruce@momjian.us>; pgsql-hackers@lists.postgresql.org

[ redirecting to pgsql-hackers ]

I wrote:
> 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.

Here's a slightly more efficient version.

			regards, tom lane

Attachments:

avoid-depending-on-search-path-in-unaccent-2.patch (text/x-diff, 1.2K) download diff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.c index 247c202..dbf2bb9 100644 *** a/contrib/unaccent/unaccent.c --- b/contrib/unaccent/unaccent.c *************** *** 20,26 **** --- 20,28 ---- #include "tsearch/ts_locale.h" #include "tsearch/ts_public.h" #include "utils/builtins.h" + #include "utils/lsyscache.h" #include "utils/regproc.h" + #include "utils/syscache.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 --- 378,398 ---- 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); ! const char *dictname = "unaccent"; ! ! dictOid = GetSysCacheOid2(TSDICTNAMENSP, ! PointerGetDatum(dictname), ! ObjectIdGetDatum(procnspid)); ! if (!OidIsValid(dictOid)) ! ereport(ERROR, ! (errcode(ERRCODE_UNDEFINED_OBJECT), ! errmsg("text search dictionary \"%s.%s\" does not exist", ! get_namespace_name(procnspid), dictname))); strArg = 0; } else
^ permalink raw reply [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 19:03 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-05 22:37   ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-09-07 22:32     ` Bruce Momjian <bruce@momjian.us>
  2018-09-07 22:43       ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Bruce Momjian @ 2018-09-07 22:32 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-hackers@lists.postgresql.org

On Wed, Sep  5, 2018 at 06:37:00PM -0400, Tom Lane wrote:
> [ redirecting to pgsql-hackers ]
> 
> I wrote:
> > 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.
> 
> Here's a slightly more efficient version.

If we are going down this route, is there any thought of handling
earchdistance the same way?

	https://www.postgresql.org/message-id/20180330205229.GS8476@momjian.us

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 19:03 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-05 22:37   ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-07 22:32     ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Bruce Momjian <bruce@momjian.us>
@ 2018-09-07 22:43       ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-07 22:56         ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2018-09-07 22:43 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-hackers@lists.postgresql.org

Bruce Momjian <bruce@momjian.us> writes:
> If we are going down this route, is there any thought of handling
> earchdistance the same way?
> 	https://www.postgresql.org/message-id/20180330205229.GS8476@momjian.us

AFAICS there are no internal-to-the-C-code search path dependencies
in earthdistance.c, so it's not the same problem.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 19:03 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-05 22:37   ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-07 22:32     ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Bruce Momjian <bruce@momjian.us>
  2018-09-07 22:43       ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-09-07 22:56         ` Bruce Momjian <bruce@momjian.us>
  2018-09-07 23:05           ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 9+ messages in thread

From: Bruce Momjian @ 2018-09-07 22:56 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-hackers@lists.postgresql.org

On Fri, Sep  7, 2018 at 06:43:52PM -0400, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > If we are going down this route, is there any thought of handling
> > earchdistance the same way?
> > 	https://www.postgresql.org/message-id/20180330205229.GS8476@momjian.us
> 
> AFAICS there are no internal-to-the-C-code search path dependencies
> in earthdistance.c, so it's not the same problem.

Uh, there is an SQL function that calls functions from the module that
fail.  It would be a CREATE FUNCTION patch, I think, but I thought the
issue was the same.

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +




^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist)
  2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
  2018-09-05 19:03 ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-05 22:37   ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-07 22:32     ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Bruce Momjian <bruce@momjian.us>
  2018-09-07 22:43       ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Tom Lane <tgl@sss.pgh.pa.us>
  2018-09-07 22:56         ` Re: unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Bruce Momjian <bruce@momjian.us>
@ 2018-09-07 23:05           ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 9+ messages in thread

From: Tom Lane @ 2018-09-07 23:05 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Gunnlaugur Thor Briem <gunnlaugur@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-hackers@lists.postgresql.org

Bruce Momjian <bruce@momjian.us> writes:
> On Fri, Sep  7, 2018 at 06:43:52PM -0400, Tom Lane wrote:
>> AFAICS there are no internal-to-the-C-code search path dependencies
>> in earthdistance.c, so it's not the same problem.

> Uh, there is an SQL function that calls functions from the module that
> fail.  It would be a CREATE FUNCTION patch, I think, but I thought the
> issue was the same.

Not really.  You could either interpolate @extschema@ into the text
of the referencing function, or (though much inferior for performance)
have it SET SEARCH_PATH FROM CURRENT.  Either of those changes would
involve an extension version bump since they're changing the extension
script.  What's more of a problem is that we could no longer claim
the extension is relocatable.  My unaccent fix dodged that by looking
up the C function's current schema, but I don't think there's any
equivalent functionality available at SQL level.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2018-09-07 23:05 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-05 08:49 unaccent(text) fails depending on search_path (WAS: pg_upgrade fails saying function unaccent(text) doesn't exist) Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
2018-09-05 14:00 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-09-05 14:06   ` Gunnlaugur Thor Briem <gunnlaugur@gmail.com>
2018-09-05 19:03 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-09-05 22:37   ` Tom Lane <tgl@sss.pgh.pa.us>
2018-09-07 22:32     ` Bruce Momjian <bruce@momjian.us>
2018-09-07 22:43       ` Tom Lane <tgl@sss.pgh.pa.us>
2018-09-07 22:56         ` Bruce Momjian <bruce@momjian.us>
2018-09-07 23:05           ` Tom Lane <tgl@sss.pgh.pa.us>

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