Re:Postgres 9.3 feature highlight: JSON operators
by eknkc on Sunday April 14, 2013 @02:49PM
(#5547784)
So, can these be mixed with functional indexes to index on json fields?
[ Parent
| on HN ]
Re:Postgres 9.3 feature highlight: JSON operators
by hannibalhorn on Sunday April 14, 2013 @07:31PM
(#5548866)
Currently, it doesn't seem so - most of the functions have their volatility declared as stable, not immutable, so you can't simply create an index on the function without getting an erorr. I think long term the postgresql guys plan on supporting special GiST indexes for JSON, but that didn't make it into 9.3.
Many of the presentations on using plv8 to access JSON in Postgres 9.2 (e.g., https://wiki.postgresql.org/images/b/b4/Pg-as-nosql-pgday-fo... ) show the use of functional indexes, but they create a plv8 function marked as immutable.
I imagine you could create a wrapper function marked immutable that calls the provided json accessor functions, but I'm not really clear on the implications of doing so.
Re:Postgres 9.3 feature highlight: JSON operators
by hannibalhorn on Saturday April 20, 2013 @11:03AM
(#5581594)
And it turns out that marking many of the JSON functions stable was an oversight and was corrected in git a few days ago: http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;...
So now it is indeed possible!