volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.73k stars 544 forks source link

Postgresql with binary_parameters=yes, JSONB type field can't be inserted or updated #580

Closed xueliangliang closed 5 years ago

xueliangliang commented 5 years ago

When postgresql connection string is with binary_parameters=yes, insert/update/upsert will return error like pq: unsupported jsonb version number 123

What version of SQLBoiler are you using (sqlboiler --version)?

Lastest 3.X master version

Related to lib/pq issue: https://github.com/lib/pq/issues/528

Is it possible for the Generator to force use string instead of json for ORM model? According to the link, it should solve the issue. Any other workaround toward this issue?

P.S The reason why we have to enable this binary_parameters=yes is due to a limitation of pg_bouncer: https://github.com/lib/pq/issues/389

aarondl commented 5 years ago

You can use type replaces (see README) to force your db types to strings.