Skip to content

fix(types): fix enum tables when used in custom mutations#680

Merged
benjie merged 3 commits intov4from
fix-1365
Oct 21, 2020
Merged

fix(types): fix enum tables when used in custom mutations#680
benjie merged 3 commits intov4from
fix-1365

Conversation

@benjie
Copy link
Copy Markdown
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