can't cast hstore to json

Started by Joe Van Dykabout 12 years ago3 messagesgeneral
Jump to latest
#1Joe Van Dyk
joe@tanga.com

I've got a postgresql 9.3.2 server, compiled from scratch. Getting this
error:

# select hstore('a', 'b')::json;
ERROR: cannot cast type hstore to json
LINE 1: select hstore('a', 'b')::json;
^
# select array_to_json(array[hstore('a', 'b')]);
array_to_json
------------------
["\"a\"=>\"b\""]
(1 row)

(I expected [{"a": "b"}] )

I don't get this on other postgresql installations. Any ideas?

Joe

#2Joe Van Dyk
joe@tanga.com
In reply to: Joe Van Dyk (#1)
Re: can't cast hstore to json

On Thu, Mar 13, 2014 at 12:15 PM, Joe Van Dyk <joe@tanga.com> wrote:

I've got a postgresql 9.3.2 server, compiled from scratch. Getting this
error:

# select hstore('a', 'b')::json;
ERROR: cannot cast type hstore to json
LINE 1: select hstore('a', 'b')::json;
^
# select array_to_json(array[hstore('a', 'b')]);
array_to_json
------------------
["\"a\"=>\"b\""]
(1 row)

(I expected [{"a": "b"}] )

I don't get this on other postgresql installations. Any ideas?

Joe

ALTER EXTENSION hstore UPDATE; fixed the problem. (thanks oicu!)

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Joe Van Dyk (#1)
Re: can't cast hstore to json

Joe Van Dyk <joe@tanga.com> writes:

I've got a postgresql 9.3.2 server, compiled from scratch. Getting this
error:

# select hstore('a', 'b')::json;
ERROR: cannot cast type hstore to json

Probably need to update the hstore extension to 1.2.

regards, tom lane

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