Re: BUG #17099: Problem with EXECUTE and JSON - Mailing list pgsql-bugs

From Sergei Kornilov
Subject Re: BUG #17099: Problem with EXECUTE and JSON
Date
Msg-id 324211626076936@mail.yandex.ru
Whole thread Raw
In response to BUG #17099: Problem with EXECUTE and JSON  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
Hello

> Why i get an error if sends text but not error if send digits ?

Because text '123' is valid JSON. text 'text' - not valid. text '"text"' is valid JSON string.

Your example could be reduced to

> select cast(json_build_object('name','name')->>'name' as jsonb);

That means

> select cast('name'::text as jsonb);

Probably you wanted ->'name', not ->>'name'. JSON(b) operator -> will return json/jsonb type.

regards, Sergei



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17100: undefined reference to `pg_qsort and pq_xxx
Next
From: PG Bug reporting form
Date:
Subject: BUG #17101: Inconsistent behaviour when querying with anonymous composite types