Re: BUG #9519: Allows storing scalar json, but fails when querying

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #9519: Allows storing scalar json, but fails when querying
Date: 2014-03-11 15:57:48
Message-ID: 1394553468645-5795538.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Alf Kristian Støyle wrote
> select data #> '{"a"}' from jtest;
> ?column?
> ----------
>
>
> "b"
> (3 rows)
>
>
> select data #> '{"a"}' from jtest where (data #> '{"a"}')::text = 'b';
> ?column?
> ----------
> (0 rows)
>
>
> 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 in
> 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 and
bottom-post.

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

Where '"b"' = '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-9519-Allows-storing-scalar-json-but-fails-when-querying-tp5795417p5795538.html
Sent from the PostgreSQL - bugs mailing list archive at Nabble.com.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message H.Merijn Brand 2014-03-11 16:01:33 Re: HP-UX 11.31 Itanium2 64bit again
Previous Message David Johnston 2014-03-11 15:47:17 Re: BUG #9519: Allows storing scalar json, but fails when querying