Graphql error: enum type does not exist because case sensitivity was not recognized
See original GitHub issueI have an existing postgres DB with an enum (native Postgres enum type) named “enum_Motivations_desired_solution” on a table named “Motivations”. When I try to insert into the table, Hasura throws an error indicating it is looking for an enum of the same name but in lower case. If I re-name the enum in Postgres to be lower case, it solves the problem. The error: { “errors”: [ { “extensions”: { “path”: “$.selectionSet.insert_Interactions.args.objects[0].Motivations.data”, “code”: “constraint-error” }, “message”: “type "enum_motivations_desired_solution" does not exist” } ] }
The query:
mutation InteractionTest {
insert_Interactions(objects: [
{
OwnerId: 5,
forUserId: 1,
initiatedByUserId: 1,
Motivations: {
data: [
{
desired_solution: "solution A",
MotivatingFactors: {
data: [{
isCurrentFactor: true,
commonFactor: "A"
},
{
isCurrentFactor: true,
commonFactor: "B"
}]
}
}
]
}
}
]) {
affected_rows
returning {
Motivations {
desired_solution
MotivatingFactors {
commonFactor
isCurrentFactor
}
}
}
}
}
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:12 (5 by maintainers)
Top Results From Across the Web
Error handling - Apollo GraphQL Docs
A client sent the hash of a query string to execute via automatic persisted queries, but the query was not in the APQ...
Read more >What you need to know about GraphQL enums
Our query is now safe, typoless, and fully discoverable. GraphQL Enums TypeScript Types Generation. But the enum value as String is not valid....
Read more >Index an enum object with case-insensitive key in TypeScript
The short answer is that you can't and you need to work around it. ... might be very confused, since they'd be expecting...
Read more >Postgres: Enum type fields | Hasura GraphQL Docs
Enum type fields are restricted to a fixed set of allowed values. ... native enum types have significant drawbacks: they are not easily...
Read more >GraphQL specification
GraphQL does not mandate a particular programming language or storage system ... GraphQL offers an Enum type in those cases, where the type...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @gentleShark , thank you for the detailed bug report, and for your patience whilst we fix it. I’m happy to say this has been fixed at https://github.com/hasura/graphql-engine/commit/d5610242542eb10c8d3ba825f2bd34fb23fb4faf, and will be available in the next stable release within two weeks.
Additional context: We don’t generate GraphQL enum types out of Postgres enums instead we generate simple custom scalar type. We treat them as
Unknown
type and insert data with String literals (''
).