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 panics on unknown Postgres type oid when decoding #1855

Merged

Conversation

demurgos
Copy link
Contributor

@demurgos demurgos commented May 4, 2022

Postgres arrays and records do not fully support custom types. When encountering an unknown OID, they currently default to using PgTypeInfo::with_oid. This is invalid as it breaks the invariant that decoding only uses resolved types, leading to panics.

This commit returns an error instead of panicking. This is merely a mitigation: a proper fix would actually add full support for custom Postgres types. Full support involves more work, so it may still be useful to fix this immediate issue.

Related issues:

Postgres arrays and records do not fully support custom types. When encountering an unknown OID, they currently default to using `PgTypeInfo::with_oid`. This is invalid as it breaks the invariant that decoding only uses resolved types, leading to panics.

This commit returns an error instead of panicking. This is merely a mitigation: a proper fix would actually add full support for custom Postgres types. Full support involves more work, so it may still be useful to fix this immediate issue.

Related issues:
- launchbadge#1672
- launchbadge#1797
@demurgos demurgos force-pushed the avoid-decoder-panic-on-custom-type branch from 1b7f668 to 0650294 Compare May 5, 2022 15:13
@abonander abonander merged commit d5f7e42 into launchbadge:master May 31, 2022
@Thomasdezeeuw
Copy link
Contributor

I think this introduced a regression for where we're now unable to SELECT an Postgres ENUM where v0.5.10 had no problem with it.

@abonander
Copy link
Collaborator

@Thomasdezeeuw can you please open an issue with a minimal example that reproduces the error you're seeing?

@Thomasdezeeuw
Copy link
Contributor

@abonander created #1920.

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.

3 participants