hasura / hasura/graphql-engine
Support nlevel function for ltree types, particularly for configuring permissions
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
Postgres' `ltree` type supports functions that do not yet seem to be exposed by Hasura. For example, [`nlevel`](https://www.postgresql.org/docs/13/ltree.html#id-1.11.7.30.6) lets you get path depth. I have an `ltree` field and I would like to
1) query by `nlevel`
2) set permissions using `nlevel`
Querying by `nlevel` can be done with a custom function. But setting permission with `nlevel` would be particularly powerful, and cannot currently be accomplished.
### Describe the solution you'd like
For Hasura to support `nlevel` in the GraphQL API and, most importantly, in the permission config.
### Describe alternatives you've considered
Duplicating the depth in a numeric field that can be used for setting permissions.
### If the feature is approved, would you be willing to submit a PR?
I am sorry but I do not have the knowledge or capacity to submit a PR for this.
Contributor guide
Research direction
No repository files or tests are named. Start by tracing how PostgreSQL ltree functions are exposed in the GraphQL API and how permission expressions are validated, then compare the nlevel behavior with the linked PostgreSQL documentation. Done means nlevel can be queried and used in permission configuration, with coverage for both paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- authorization, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100