hasura / hasura/graphql-engine

Cannot include \"XXX.YYY\" in the GraphQL schema because it is not a valid GraphQL identifier

Open
#8,597 4 comments 1 reaction 0 assignees View on GitHub
k/bug
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: v2.7.0

### Environment

OSS

### What is the expected behaviour?

The GraphQL identifier should replace the `.` character from PostgreSQL field name with `_`

### Keywords

it is not a valid GraphQL identifier

### What is the current behaviour?
We're receiving the below error:
```json
[
{
"definition": {
"schema": "xxxx",
"name": "yyyyy"
},
"reason": "Inconsistent object: cannot include \"XXX.YYY\" in the GraphQL schema because it is not a valid GraphQL identifier",
"name": "table xxxx.yyyyy in source default",
"type": "table"
}
]
```

### How to reproduce the issue?

1. Create a PostgreSQL column named `XXX.YYY`
2. Try to track the table which contains the created column
3. You will receive the above error

### Any possible solutions?

Replace `.` character with `_` when generating GraphQL identifier.

### Can you identify the location in the source code where the problem exists?
https://github.com/hasura/graphql-engine/blob/6e8da71ece69e363e9fa5bace3cef8a33e51cc5a/server/src-lib/Hasura/Backends/Postgres/SQL/Types.hs#L265

Contributor guide

Open the contributing guide

Research direction

Start in server/src-lib/Hasura/Backends/Postgres/SQL/Types.hs at the referenced line and inspect how PostgreSQL field names become GraphQL identifiers. Reproduce with a PostgreSQL column named XXX.YYY, then verify that tracking its table succeeds and the generated identifier uses an underscore instead of a dot.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, haskell, postgresql
Domain
api, databases
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.