Re: BUG #5781: unaccent() function should be marked IMMUTABLE

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: BUG #5781: unaccent() function should be marked IMMUTABLE
Дата
Msg-id 201012272035.oBRKZ2Y27272@momjian.us
обсуждение исходный текст
Ответ на Re: BUG #5781: unaccent() function should be marked IMMUTABLE  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-bugs
Robert Haas wrote:
> On Wed, Dec 22, 2010 at 8:45 PM, Bruce Momjian <bruce@momjian.us> wrote:
> > Tom Lane wrote:
> >> "Grant Hutchins and Peter Jaros" <grant@pivotallabs.com> writes:
> >> > The unaccent(text) function supplied by contrib/unaccent is marked VOLATILE.
> >> > This prevents it from being used in indexes. We believe that the function
> >> > meets the requirements to be marked IMMUTABLE.
> >>
> >> No, it most certainly doesn't. ?It depends on the behavior of a
> >> dictionary that it has no hard-wired connection to, so the specific
> >> behavior of the dictionary is uncertain. ?Even if you're willing to
> >> assume that the dictionary being used is the one defined by this
> >> module, that dictionary depends on external configuration files
> >> which are easily changeable.
> >>
> >> Arguably it'd be reasonable to change the function's marking from
> >> volatile to stable, but that's not going to be enough to allow use in
> >> indexes.
> >
> > So, should we change unaccent() from VOLATILE to STABLE?
>
> Sounds like it, but it doesn't sound like it will help much.  :-(

OK, done, with attached, applied patch.

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

  + It's impossible for everything to be true. +
diff --git a/contrib/unaccent/unaccent.sql.in b/contrib/unaccent/unaccent.sql.in
index 7e397cc..6d712e7 100644
*** /tmp/l3zFae_unaccent.sql.in    Mon Dec 27 15:33:55 2010
--- contrib/unaccent/unaccent.sql.in    Mon Dec 27 15:24:16 2010
*************** SET search_path = public;
*** 6,17 ****
  CREATE OR REPLACE FUNCTION unaccent(regdictionary, text)
      RETURNS text
      AS 'MODULE_PATHNAME', 'unaccent_dict'
!     LANGUAGE C STRICT;

  CREATE OR REPLACE FUNCTION unaccent(text)
      RETURNS text
      AS 'MODULE_PATHNAME', 'unaccent_dict'
!     LANGUAGE C STRICT;

  CREATE OR REPLACE FUNCTION unaccent_init(internal)
      RETURNS internal
--- 6,17 ----
  CREATE OR REPLACE FUNCTION unaccent(regdictionary, text)
      RETURNS text
      AS 'MODULE_PATHNAME', 'unaccent_dict'
!     LANGUAGE C STABLE STRICT;

  CREATE OR REPLACE FUNCTION unaccent(text)
      RETURNS text
      AS 'MODULE_PATHNAME', 'unaccent_dict'
!     LANGUAGE C STABLE STRICT;

  CREATE OR REPLACE FUNCTION unaccent_init(internal)
      RETURNS internal

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: IN clause on BYTEA column works against table directly but gives error against view
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: BUG #5784: CREATE INDEX USING GIN complains about array containing null values yet none exist