hasura / hasura/graphql-engine
Server: Ability to use `current_setting('hasura.user')` in Views
Open
c/server
k/enhancement
t/native-dbs
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
right now for mutation transactions have `hasura.user` available to them but It would be nice to have it available for views as well so we can do something like
```sql
CREATE VIEW user_articles AS
SELECT id, title, content from articles
where author_id = current_setting('hasura.user') :: json ->> 'x-hasura-user-id'
```
Contributor guide
Research direction
No files or tests are named. Start by comparing how hasura.user is made available during mutation transactions with how PostgreSQL views are executed; done means the setting is available to views so the demonstrated current_setting query can filter rows as intended.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100