hasura / hasura/graphql-engine

Does hasura support postgresql "CREATE TYPE"?

Open
#8,426 1 comment 0 reactions 0 assignees View on GitHub
k/enhancement
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.