Carlos Mendes - 181 - Feb 7, 2015

Anyone using OrmLite with Postgres 9.4? I’m looking for some examples on how to use the JSON datatype:


There’s no built-in support for pgsql’s JSON data type in OrmLite yet. Not even sure if custom sql queries work as it requires support from the underlying Npgsql ADO.NET driver and I had issues with it last time I tried it.

Carlos Mendes:

Thank you Demis.

I’ll try to find out the current status of Npgsql since having this would be great to avoid EAV patterns and still have querying support.

They say PostgreSQL with Json is faster than Mongo so I’m really eager to give it a try :slight_smile:

Sure, tho the automatic and transparent blobbing of complex property types in OrmLite lets you get a lot of the benefits of a schema-less NoSql data type already, it’s just missing the server-side querying support.

Carlos Mendes:

Here’s the current status:

‘our docs are out of date, we’re planning a reorganization of that soon.

JSON and JSONB types are supported as simple strings. You can fetch JSON/JSONB columns and the reader will expose them as string columns. You can send JSON data as parameters, as strings as well.

Please write back here if you encounter any issues.’

ok brilliant, that will make things easier to support, thx.

Has additional support been added over the last year to serialize complex property types to a jsonb field instead of a text field? It would be great to serialize complex types to jsonb to take advantage of jsonb indexing. Thank you.

no, there’s no support for JSONB.

I’m receiving the following error: Npgsql.PostgresException: 42804: column “test_jsonb” is of type jsonb but expression is of type text. I’ve tried having my property (for the corresponding jsonb) column be string as well as a complex type. I get the same error in both cases. Any assistance is greatly appreciated.