jeremydaly / data-api-client

A "DocumentClient" for the Amazon Aurora Serverless Data API
MIT License
439 stars 61 forks source link

column [column name] is of type jsonb but expression is of type character varying #34

Closed naveennazimudeen closed 4 years ago

naveennazimudeen commented 4 years ago

In Postgres, an insert that has jsonb data type gives the error: column [column name] is of type jsonb but expression is of type character varying

naveennazimudeen commented 4 years ago

I got it to work based on the input on this thread: https://forums.aws.amazon.com/thread.jspa?messageID=921843&#921843

'INSERT into post (content, created_by) values (:content::jsonb, :created_by::uuid) returning post_uuid', { content: JSON.stringify({...}), created_by: created_by }

jeremydaly commented 4 years ago

Thanks for the note. This library has a conflict with some PostgreSQL features, so I'm in the process of fixing that.

MarkHerhold commented 4 years ago

I also am hitting the same issue with enums in PG. This lib assumes enums are a string, even with casting (::enum).

parameters: [
  { name: 'column', value: { stringValue: '<some enum value>' } }
]
jeremydaly commented 4 years ago

Closing this in favor of #27