Skip to content

fix: support empty postgres enum variants#304

Open
leno23 wants to merge 1 commit into
cornucopia-rs:mainfrom
leno23:fix/289-empty-enum-variant
Open

fix: support empty postgres enum variants#304
leno23 wants to merge 1 commit into
cornucopia-rs:mainfrom
leno23:fix/289-empty-enum-variant

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 20, 2026

Summary

  • generate a valid Rust enum variant when a Postgres enum contains an empty string value
  • reuse the same variant-name fallback in both custom type and SQL conversion generation
  • add regression tests covering the empty Postgres enum variant case

Fixes #289.

Test Plan

  • cargo fmt --check
  • cargo test -p cornucopia -- codegen::types::tests
  • cargo test -p cornucopia
  • cargo clippy -p cornucopia -- -D warnings
  • git diff --check

@LouisGariepy
Copy link
Copy Markdown
Member

Thanks for opening this PR. I added some thoughts here, in addition to what beanpuppy has already said. Please let me know what you think :)

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.

Postgres enum types with an empty string as a valid value will break all parsing

2 participants