Storing JSONB in Postgres
We successfully use quite a few JSONB columns in our app. You don’t say
which version of Studio you are on but in 8.1 you can use:
Do PGSession.$new() Returns oSession
Do oSession.$addcustomtype(50000,’JSONB’) ;; the 50000 can be any
arbitrary number <= 65534 or exactly 100000000* The DAM will then do the conversion for you whenever it sees a Character column with length 50000. Of course, you have to make sure none of your text columns are of length 50000. * I have registered a Fault ST/SC/079 with support, Character columns of >= 65535 get mapped to 10000000. They have told me it’s fixed for 8.2
Because of the above fault and the fact we have some huge JSON arrays,
we use 10000000 as our custom type and have reduced all our schema text
columns to 65500.
On 09/02/2018 08:42, myEcoCost Admin 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 at gmail.com