Re: [BUGS] BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable - Mailing list pgsql-bugs

From Tom Lane
Subject Re: [BUGS] BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable
Date
Msg-id 9162.1500229785@sss.pgh.pa.us
Whole thread Raw
In response to [BUGS] BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable  (007reader@gmail.com)
List pgsql-bugs
007reader@gmail.com writes:
> According to https://www.postgresql.org/about/news/1763/ Beta 2 marked
> to_tsvector(regconfig, json[b]) immutable, but it still doesn't work, at
> least in the docker version of Beta 2. Here is the result:

> create table test (j JSON, jb JSONB);
> CREATE TABLE

> create index j_ixd on test using gin(to_tsvector(j));
> ERROR:  functions in index expression must be marked IMMUTABLE

> create index jb_ixd on test using gin(to_tsvector(jb));
> ERROR:  functions in index expression must be marked IMMUTABLE

Um, but that's not the two-argument version of to_tsvector.
You need something like

regression=# create index j_ixd on test using gin(to_tsvector('english', j));
CREATE INDEX
regression=# create index j_ixd2 on test using gin(to_tsvector('english', jb));
CREATE INDEX

The point here is that the single-argument versions are affected by
the configuration setting default_text_search_config, so they can't
be used in an index.  Nailing down which tsconfig to use makes them
indexable.
        regards, tom lane


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: 007reader@gmail.com
Date:
Subject: [BUGS] BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable
Next
From: Jeff Janes
Date:
Subject: Re: [BUGS] BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable