Re: [GENERAL] jsonb - Mailing list pgsql-general

From hmidi slim
Subject Re: [GENERAL] jsonb
Date
Msg-id CAMsqVxvpBPy5shgEaLqLY45mjEAdUBfijxQTFJuw0qHFdNc3wA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] jsonb  (Merlin Moncure <mmoncure@gmail.com>)
Responses Re: [GENERAL] jsonb
Re: [GENERAL] jsonb
List pgsql-general
I'm trying to use the function to_jsonb and create the name:
to_jsonb ('{"key1":" ' || 'text1' || '","key2":" ' || 'text2' || '"}');
But after that I used Objection.js ORM to get data using the query:
Product.query().where('id',1).then(prod => {console.log(prod)})
I think that the problem maybe with the usage of to_jsonb function, maybe I miss something. But when I fetch the data with the ORM I found that the type was a string and not a jsonb


2017-11-14 23:09 GMT+01:00 Merlin Moncure <mmoncure@gmail.com>:
On Tue, Nov 14, 2017 at 3:32 PM, hmidi slim <hmidi.slim2@gmail.com> wrote:
> I have a column name of type 'jsonb' on my table named product. The format
> of the column:
> name: {"key1": "text1", "key2": "text2"}
>
> When I make a query to fetch data from the table I got this format:
> name: '{"key1": "text1", "key2": "text2"}'
>
> Why does postgresql returns the name such as string type and not jsonb? is
> it a bug or is there something else to add?

not quite following.  Can you paste the query you are trying to
execute along with the results vs. expectation?  thanks

merlin

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: [GENERAL] jsonb
Next
From: Tatsuo Ishii
Date:
Subject: Re: [GENERAL] PGPool in Master-Master mode, is it possible?