pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: 007reader@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable
Date: Sun, 16 Jul 2017 14:29:45 -0400
Message-ID: <9162.1500229785@sss.pgh.pa.us> (raw)
In-Reply-To: <20170716181004.9231.22003@wrigleys.postgresql.org>
References: <20170716181004.9231.22003@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (3+ messages)  latest in thread

Message-ID: <9162.1500229785@sss.pgh.pa.us>
Permalink:  ../9162.1500229785@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9162.1500229785@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, 007reader@gmail.com
  Subject: Re: BUG #14745: to_tsvector(regconfig, json[b]) is NOT immutable
  In-Reply-To: <9162.1500229785@sss.pgh.pa.us>
  References: <20170716181004.9231.22003@wrigleys.postgresql.org> <9162.1500229785@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox