Storing JSONB in Postgres
Thanks, Bas.
> On Feb 8, 2018, at 5:49 PM, Bastiaan Olij <bastiaan@basenlily.me> wrote:
>
> Hi Scotte,
>
> Since Omnis hasn’t got a clue that there is such a thing as a JSON data
> type it can’t handle this by itself.
> You need to add a little bit of code to your table class to handle the
> conversion between text and jsonb and back again.
>
> The simplest way to do this would be to do something like this:
> —
> tMyTable.$selectnames()
> Calculate lvSQL as $inherited.$selectnames()
> Calculate lvSQL as replace(lvSQL,’MyJSONColumn’,’MyJSONColumn::text’)
> Quit Method lvSQL
>
> tMyTable.$insertnames(cRowName)
> Calculate lvSQL as $inherited.$insertnames(cRowName)
> Calculate lvSQL as
> replace(lvSQL,con(‘@[‘,cRowName,’.MyJSONColumn]’),con(‘cast(@[‘,cRowName,’.MyJSONColumn]
> as jsonb)’))
> Quit Method lvSQL
> —
>
> And do the same with $updatenames as well.
>
> Cheers,
>
> Bas
>
>
> On 9/2/18 12:19 pm, Scotte Meredith wrote:
>> Has anyone used the JSONB field type in Postgres?
>>
>> I’m trying to store in that field using either binary or character as the data type for the schema and Postgres is complaining that there is a data mismatch.
>>
>> Native error code: -1 – ERROR: column “release_automation_data” is of type jsonb but expression is of type text
>>
>> I have tried setting the schema data type to character, binary & object and always the same message.
>>
>>
>> What should the column in the Studio schema be defined as?
>>
>>
>> Scotte Meredith
>> SpoMacGuy@gmail.com
>>
>> _____________________________________________________________
>> Manage your list subscriptions at lists.omnis-dev.com
>> Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
>
>
> —
> Kindest Regards,
>
> Bastiaan Olij
> e-mail: bastiaan@basenlily.me
> web: www.basenlily.me
> Skype: Mux213
> www.linkedin.com/in/bastiaanolij
>
> _____________________________________________________________
> Manage your list subscriptions at lists.omnis-dev.com
> Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com
Scotte Meredith
SpoMacGuy@gmail.com
_____________________________________________________________
Manage your list subscriptions at lists.omnis-dev.com
Start a new message -> mailto:omnisdev-en@lists.omnis-dev.com