pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Sergei Kornilov <sk@zsrv.org>
To: ineron@icloud.com <ineron@icloud.com>
To: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17099: Problem with EXECUTE and JSON
Date: Mon, 12 Jul 2021 11:06:33 +0300
Message-ID: <324211626076936@mail.yandex.ru> (raw)
In-Reply-To: <17099-7b756eb97b8e9e7a@postgresql.org>
References: <17099-7b756eb97b8e9e7a@postgresql.org>

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





view thread (3+ messages)

Message-ID: <324211626076936@mail.yandex.ru>
Permalink:  ../324211626076936@mail.yandex.ru/
Also on:    postgresql.org/message-id/324211626076936@mail.yandex.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: sk@zsrv.org, ineron@icloud.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #17099: Problem with EXECUTE and JSON
  In-Reply-To: <324211626076936@mail.yandex.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox