Re: BUG #9519: Allows storing scalar json, but fails when querying - Mailing list pgsql-bugs

From David Johnston
Subject Re: BUG #9519: Allows storing scalar json, but fails when querying
Date
Msg-id 1394553468645-5795538.post@n5.nabble.com
Whole thread Raw
In response to Re: BUG #9519: Allows storing scalar json, but fails when querying  (Alf Kristian Støyle <alf.kristian@gmail.com>)
List pgsql-bugs
Alf Kristian St=C3=B8yle wrote
> select data #> '{"a"}' from jtest;
>  ?column?
> ----------
>=20
>=20
>  "b"
> (3 rows)
>=20
>=20
> select data #> '{"a"}' from jtest where (data #> '{"a"}')::text =3D 'b';
>  ?column?
> ----------
> (0 rows)
>=20
>=20
> Am I doing a wrong conversion here, or is something else going on? If the
> data in the database did not contain scalar values, then ->> works fine i=
n
> WHERE. The following is almost the query we are actually trying run
> (checking for existence):

Side not - please follow the example set by others and trim your quoting an=
d
bottom-post.

As to your comment - the example above shows that the where clause is
evaluating to:

Where '"b"' =3D 'b' -- which is false.

Maybe try #>> which is defined to return text instead of an object.

David J.





--
View this message in context: http://postgresql.1045698.n5.nabble.com/BUG-9=
519-Allows-storing-scalar-json-but-fails-when-querying-tp5795417p5795538.ht=
ml
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

pgsql-bugs by date:

Previous
From: David Johnston
Date:
Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying
Next
From: Jeff Janes
Date:
Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying