hasura / hasura/graphql-engine

support VOLATILE function for computed field.

Open
#9,517 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement t/native-dbs
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

> I have a case where using a VOLATILE SQL function in a computed field would simplify things alot.

> I also noticed I can create the function as STABLE, add it as computed field, and then change the function to VOLATILE and it works just fine in hasura.

> But feels hacky and hasura complains on metadata reload. Also seem's there's not really much needed to support this except allowing VOLATILE function to be tracked, at least in my case.

> Will the work for this issue support this use case as well ?

_Originally posted by @karibertils in https://github.com/hasura/graphql-engine/issues/1514#issuecomment-711073631_

Any chance volatile functions for computed fields can be enabled? If I do the above trick the computed fields of a table, returned by a custom query function (`returns setof`) are correct. If my computed fields functions are `STABLE` they have the value from before the mutation occured.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating computed-field tracking and the handling of PostgreSQL function volatility described in the issue; done means VOLATILE functions can be tracked without metadata reload complaints and computed fields reflect values after mutations.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.