postgres: Error: cannot cast type boolean to jsonb

Hello. Version postgres 3.2.4.

await sql`SELECT ${true}::jsonb`;

Result postgresql error:

Cannot cast type boolean to jsonb

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 25 (12 by maintainers)

Most upvoted comments

@uasan oh shoot, that’s actually not the only issue. Same goes for the other inferred types (Date, Buffer, Bigint) 😦 I should have caught this for the v3 update and completely removed inferType (https://github.com/porsager/postgres/blob/218a7d4f37dcbf76d01081413a386c00544ab63e/src/types.js#L213) to let PostgreSQL decide 😕 Changing this would require a major bump, but my initial idea right now is that it would be the best direction.