avoid-depending-on-search-path-in-unaccent-2.patch
text/x-diff
Filename: avoid-depending-on-search-path-in-unaccent-2.patch
Type: text/x-diff
Part: 0
Patch
Format: unified
| File | + | − |
|---|---|---|
| contrib/unaccent/unaccent.c | 0 | 0 |
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