hasura / hasura/graphql-engine
Does hasura support postgresql "CREATE TYPE"?
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
i create type by sql
```sql
CREATE TYPE "Role" AS ENUM ('ADMIN', 'USER');
ALTER TABLE "user" ADD COLUMN "role" "Role" NOT NULL DEFAULT E'USER';
```
and try to filter it by graphql
```graphql
{
"role": {
"_eq": "ADMIN"
}
}
```
hasura tell me
```json
{
"errors": [
{
"extensions": {
"path": "$",
"code": "constraint-error"
},
"message": "type \"role\" does not exist"
}
]
}
```
so i can't filter a enum type in hasura
### Describe the solution you'd like
support the "CREATE TYPE" on postgresql
https://www.postgresql.org/docs/8.2/sql-createtype.html
Contributor guide
Research direction
Start by reproducing the PostgreSQL CREATE TYPE and ALTER TABLE statements, then run the shown GraphQL filter and compare the resulting constraint error. Determine which PostgreSQL enum behavior Hasura must support; done means the enum column can be queried with the demonstrated filter without the type-not-found error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, postgresql
- Domain
- api, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100