Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception in Postgres inserting None value for Option[JsonValue[...]] or Option[JsonbValue[...]] fields #3023

Merged
merged 2 commits into from
May 2, 2024

Conversation

vladimirkl
Copy link
Contributor

@vladimirkl vladimirkl commented Apr 23, 2024

Fixes #3022

Problem

Exception in Postgres inserting None value for Option[JsonValue[...]] or Option[JsonbValue[...]] fields:
ERROR: column "..." is of type json but expression is of type character varying

Solution

This PR fixes entityEncoder and astEncoder methods in PostgresJsonExtensions trait by changing sqlType parameter from Types.VARCHAR to Types.OTHER.

Notes

Checklist

  • Unit test all changes
  • Update README.md if applicable
  • Add [WIP] to the pull request title if it's work in progress
  • Squash commits that aren't meaningful changes
  • Run sbt scalariformFormat test:scalariformFormat to make sure that the source files are formatted

@getquill/maintainers

@vladimirkl vladimirkl changed the title Fix #3022 Fix exception in Postgres inserting None value for Option[JsonValue[...]] or Option[JsonbValue[...]] fields Apr 23, 2024
Copy link
Collaborator

@juliano juliano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you for your contribution here! 👍

@juliano juliano merged commit 36c8ae4 into zio:master May 2, 2024
13 checks passed
@guizmaii
Copy link
Member

guizmaii commented May 7, 2024

We need to backport this fix (if needed) and (at least) the corresponding tests to zio-protoquill.

@vladimirkl Do you want to make this work? That'd be great 🙂

When this is backported to zio-protoquill, I'd like to make a new patch release

@vladimirkl
Copy link
Contributor Author

Sure, will try backporting this into zio-protoquill

@guizmaii
Copy link
Member

guizmaii commented May 7, 2024

@vladimirkl Thanks! 🙏

@vladimirkl
Copy link
Contributor Author

@guizmaii done

@guizmaii
Copy link
Member

guizmaii commented May 7, 2024

Thank you so much @vladimirkl! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception in Postgres inserting None value for Option[JsonValue[...]] or Option[JsonbValue[...]] fields
3 participants