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(types): fix enum tables when used in custom mutations #680

Merged
merged 3 commits into from
Oct 21, 2020
Merged

Conversation

benjie
Copy link
Member

@benjie benjie commented Oct 21, 2020

Description

@brendanmckenzie reported graphile/crystal#1365 pointing out there's an issue when types that reference enum types are used in custom mutations. This is because we explicitly cast the type of each column, and when we were casting the enum to it's fake name it happened to overlap with the table name, so PostgreSQL thought it was a table reference. Really it should have been a cast to ::text or whatever type the enum column is.

For now I've solved this by casting to ::unknown if the type is fake; but we should solve it better in the long run by having the PgType have a sqlFullyQualifiedTypeName field that we can override for fake types to be the type of the column on the enum (e.g. pg_catalog.text).

Fixes graphile/crystal#1365

Performance impact

Negligible.

Security impact

Fixes a bug.

@benjie benjie merged commit ed75ce2 into v4 Oct 21, 2020
@benjie benjie deleted the fix-1365 branch October 21, 2020 13:30
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.

malformed record literal with table-based enums and functions
1 participant