Menu

#332 Add JSON and JSONB types support for PostgreSQL compatibility mode

open-later
None
9
2022-07-28
2016-11-14
Pawel Jagus
No

I think it would be good idea to add some kind of simulating/stubbing the JSON and JSONB types while in the PostgreSQL mode. It would help a lot in unit testing.

Discussion

  • Fred Toussi

    Fred Toussi - 2016-11-14

    We might at some point support these types. In the meantime, you can create a TYPE or DOMAIN with the relevant name to simulate them to some extent.

     
  • Pawel Jagus

    Pawel Jagus - 2016-11-15

    Yes, this is what I actually do. I create those types in the following way.

    DROP TYPE json IF EXISTS;
    CREATE TYPE json AS text;
    DROP TYPE jsonb IF EXISTS;
    CREATE TYPE jsonb AS binary;

    This works fine on the DDL level but not on the DML one.
    When I try to insert a record into the table in which the json column is given I get the exception.

    org.hsqldb.HsqlException: incompatible data type in conversion

    For mapping the json and jsonb types I am using the Vlad Mihalcea's solution which can be found here https://vladmihalcea.com/2016/06/20/how-to-map-json-objects-using-generic-hibernate-types/.

     
  • Fred Toussi

    Fred Toussi - 2022-07-28
    • status: open --> open-later
    • assigned_to: Fred Toussi
     

Log in to post a comment.

MongoDB Logo MongoDB