ltree::text not immutable? - Mailing list pgsql-bugs

From Joe Van Dyk
Subject ltree::text not immutable?
Date
Msg-id CACfv+pL2oX08SSZSoaHpyC=UbfTFmPt4UmVEKJTH7y=2QMRCBw@mail.gmail.com
Whole thread Raw
Responses Re: ltree::text not immutable?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
create table t1 (json json);
create index on t1 using btree((json::text));
-- Above works as expected

create extension ltree;
create table t2 (ltree ltree);
create index on t2 using btree((ltree::text));
psql:/tmp/t.sql:8: ERROR:  functions in index expression must be marked
IMMUTABLE

What I'm trying to do is quickly grab the root category from an categories
ltree.

Doing something like
  where root_categories.id = subtree(ltree, 0, 1)
and was trying to make some indexes to make this go faster.

Seems like casting ltree to text and the subtree function should be
immutable?

pgsql-bugs by date:

Previous
From: keyurgovande@gmail.com
Date:
Subject: BUG #11767: ODBC driver bug when fetching constant string columns
Next
From: Tom Lane
Date:
Subject: Re: BUG #11771: wrong behaviour of planner when pushing conditions