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

Encoder panics on composite type arrays containing pgtype.Numeric #102

Open
kirk-anchor opened this issue Jan 4, 2024 · 1 comment
Open

Comments

@kirk-anchor
Copy link

Using an array of a composite type with a numeric column and no --go-type override results in a panic

panic: encode []FeeConfig: cannot convert {1 -2 2 false none} to Numeric

This does not occur if your generated structs use a string with --go-type 'numeric=string'

However pgtype.Numeric has a bug in string conversion, I reported it upstream jackc/pgtype#210

For now, I will use the last pggen commit that still contains QuerierConfig and everything works properly with --go-type 'numeric=github.com/shopspring/decimal.Decimal'

@kirk-anchor
Copy link
Author

The string conversion bug has now been fixed in pgtype.Numeric so --go-type 'numeric=string' can be used as a workaround to allow using numeric columns in composite types

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

No branches or pull requests

1 participant