Add complex_helper support to pg_update_dict/pg_update - #16
Merged
Conversation
pg_update_dict had no way to adapt composite/enum column values the way pg_insert/pg_upsert_dict already do via ComplexHelper, so updating an enum-typed column through it fails with a type mismatch unless the caller hand-writes the UPDATE with an explicit ::type cast. New complex_helper kwarg defaults to None, preserving existing call sites exactly.
aersam
force-pushed
the
feature/pg-update-dict-complex-helper
branch
from
July 28, 2026 12:47
d28ab52 to
a97bcf9
Compare
test_update_enum_column_requires_complex_helper asserted that updating an enum column without a ComplexHelper raises -- verified against a real Postgres that this is false: psycopg already binds a plain str to an enum-typed UPDATE target fine on its own. Replaced it with a composite-column test, which is the actual case that fails without complex_helper (psycopg has no adapter for a plain dict against a composite type). Kept the enum test as a plain round-trip check instead of a failure assertion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pg_update_dict had no way to adapt composite/enum column values the way pg_insert/pg_upsert_dict already do via ComplexHelper, so updating an enum-typed column through it fails with a type mismatch unless the caller hand-writes the UPDATE with an explicit ::type cast. New complex_helper kwarg defaults to None, preserving existing call sites exactly.