Re: [BUGS] stable vs. immutable unaccent function

2013-05-05 Thread Thangalin
Hi, I wrote the unaccent_text wrapper function to achieve the following: CREATE INDEX table_name_label_unaccent_idx ON table_name USING gin (unaccent_text(label::text) COLLATE pg_catalog."default" gin_trgm_ops); I would have liked to use unaccent directly. The fact that someone wrote such

Re: [BUGS] stable vs. immutable unaccent function

2013-05-05 Thread Greg Stark
On Sun, May 5, 2013 at 9:01 PM, Marti Raudsepp wrote: > A STABLE function may call an IMMUTABLE function, but not the other way > around. Well no, an immutable function can and may call a stable (or even volatile) function. Postgres won't stand in your way. It's probably a bad idea unless it's c

Re: [BUGS] stable vs. immutable unaccent function

2013-05-05 Thread Marti Raudsepp
On Sun, May 5, 2013 at 5:05 AM, Thangalin wrote: > CREATE OR REPLACE FUNCTION unaccent_text(text) > -- unaccent is STABLE, but the indexes must use IMMUTABLE functions. > -- comment this line out when calling pg_dump. The fact that someone wrote such a comment should be a clue that it's a ha

[BUGS] stable vs. immutable unaccent function

2013-05-04 Thread Thangalin
Hi, Given the following function: CREATE OR REPLACE FUNCTION unaccent_text(text) RETURNS text AS $BODY$ -- unaccent is STABLE, but the indexes must use IMMUTABLE functions. -- comment this line out when calling pg_dump. SELECT unaccent($1); -- Uncomment this line when calling pg_dump.