On Tue, Feb 19, 2013 at 08:30:29AM +0100, Pavel Stehule wrote:
> Hello
> 
> There was a proposal to change flag of function to immutable - should
> be used in indexes
> 
> CREATE FUNCTION unaccent(regdictionary, text)
>         RETURNS text
>         AS 'MODULE_PATHNAME', 'unaccent_dict'
>         LANGUAGE C STABLE STRICT;
> 
> 
> is there any progress?

I have developed the attached patch based on your suggestion.  I did not
see anything in the code that would make it STABLE, except a lookup of a
dictionary library:

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

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

  + It's impossible for everything to be true. +
diff --git a/contrib/unaccent/unaccent--1.0.sql b/contrib/unaccent/unaccent--1.0.sql
new file mode 100644
index 9085ca4..072b749
*** a/contrib/unaccent/unaccent--1.0.sql
--- b/contrib/unaccent/unaccent--1.0.sql
***************
*** 6,17 ****
  CREATE FUNCTION unaccent(regdictionary, text)
  	RETURNS text
  	AS 'MODULE_PATHNAME', 'unaccent_dict'
! 	LANGUAGE C STABLE STRICT;
  
  CREATE FUNCTION unaccent(text)
  	RETURNS text
  	AS 'MODULE_PATHNAME', 'unaccent_dict'
! 	LANGUAGE C STABLE STRICT;
  
  CREATE FUNCTION unaccent_init(internal)
  	RETURNS internal
--- 6,17 ----
  CREATE FUNCTION unaccent(regdictionary, text)
  	RETURNS text
  	AS 'MODULE_PATHNAME', 'unaccent_dict'
! 	LANGUAGE C IMMUTABLE STRICT;
  
  CREATE FUNCTION unaccent(text)
  	RETURNS text
  	AS 'MODULE_PATHNAME', 'unaccent_dict'
! 	LANGUAGE C IMMUTABLE STRICT;
  
  CREATE FUNCTION unaccent_init(internal)
  	RETURNS internal
diff --git a/contrib/unaccent/unaccent--unpackaged--1.0.sql b/contrib/unaccent/unaccent--unpackaged--1.0.sql
new file mode 100644
index abd0698..5bff74e
*** a/contrib/unaccent/unaccent--unpackaged--1.0.sql
--- b/contrib/unaccent/unaccent--unpackaged--1.0.sql
*************** ALTER EXTENSION unaccent ADD function un
*** 10,16 ****
  ALTER EXTENSION unaccent ADD text search template unaccent;
  ALTER EXTENSION unaccent ADD text search dictionary unaccent;
  
! -- These functions are marked as stable in 9.1, were not before:
  
! ALTER FUNCTION unaccent(regdictionary, text) STABLE;
! ALTER FUNCTION unaccent(text) STABLE;
--- 10,16 ----
  ALTER EXTENSION unaccent ADD text search template unaccent;
  ALTER EXTENSION unaccent ADD text search dictionary unaccent;
  
! -- These functions were marked as stable in 9.1; they were now marked as immutable
  
! ALTER FUNCTION unaccent(regdictionary, text) IMMUTABLE;
! ALTER FUNCTION unaccent(text) IMMUTABLE;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to