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

Handle json and jsonb types as bytes. #240

Merged
merged 4 commits into from
Jan 10, 2025
Merged

Conversation

lyuboxa
Copy link
Contributor

@lyuboxa lyuboxa commented Jan 9, 2025

Description

By default pgx will use encoding/json and return a map of the json. This behaviour does not play well with Avro and can result in each record to emit different schema (since JSON can be anything).

Thus any JSON data will be returned as bytes and allow the user to serder into whatever type they desire.

Fixes #229

Quick checks:

  • I have followed the Code Guidelines.
  • There is no other pull request for the same update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

By default pgx will use encoding/json and return a map of the json.
This behaviour does not play well with Avro and can result in each record
to emit different schema (since JSON can be anything).

Thus any JSON data will be returned as bytes and allow the user to serder into
whatever type they desire.
@lyuboxa lyuboxa merged commit 134b515 into main Jan 10, 2025
3 checks passed
@lyuboxa lyuboxa deleted the lk/handle-jsonb-json-as-bytes branch January 10, 2025 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Bug: failed to extract payload schema: cannot resolve field type \"jsonb\"
2 participants