Re: BUG #17099: Problem with EXECUTE and JSON

From: Sergei Kornilov <sk(at)zsrv(dot)org>
To: "ineron(at)icloud(dot)com" <ineron(at)icloud(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #17099: Problem with EXECUTE and JSON
Date: 2021-07-12 08:06:33
Message-ID: 324211626076936@mail.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2021-07-12 08:37:31 BUG #17101: Inconsistent behaviour when querying with anonymous composite types
Previous Message PG Bug reporting form 2021-07-12 08:00:16 BUG #17100: undefined reference to `pg_qsort and pq_xxx