pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Johannes Graën <johannes@selfnet.de>
To: hmidi slim <hmidi.slim2@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: jsonb
Date: Wed, 15 Nov 2017 00:37:39 +0100
Message-ID: <98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de> (raw)
In-Reply-To: <46c9439f-ae20-c72f-31ff-b21a942eaac1@gmail.com>
References: <46c9439f-ae20-c72f-31ff-b21a942eaac1@gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>

On 11/14/2017 11:30 PM, hmidi slim wrote:
> I'm trying to use the function to_jsonb and create the name:
> to_jsonb ('{"key1":" ' || 'text1' || '","key2":" ' || 'text2' || '"}');

This query converts a string into a JSON object that consist of that
string. I guess what you intend to accomplish is rather:

select jsonb_build_object('key1', 'text1', 'key2', 'text2');




-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



view thread (6+ messages)  latest in thread

Message-ID: <98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de>
Permalink:  ../98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de/
Also on:    postgresql.org/message-id/98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: johannes@selfnet.de, hmidi.slim2@gmail.com
  Subject: Re: jsonb
  In-Reply-To: <98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de>
  References: <46c9439f-ae20-c72f-31ff-b21a942eaac1@gmail.com> <98fad95e-e731-cf0d-f4d3-3968a945c8a4@selfnet.de>

* 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