hasura / hasura/graphql-engine

Computed field filtering doesn't work

Open
#10,011 0 comments 0 reactions 0 assignees View on GitHub
k/bug t/native-dbs v2
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Version Information

Server Version: v2.35.1-cloud2
CLI Version (for CLI related issue): version=2.35.1

### Environment

Cloud

### What is the current behaviour?
I have a computed field in order_tenant table which is `order_tenant_no`. It produced via a simple function :
```
CREATE OR REPLACE FUNCTION public.generate_order_tenant_no(order_item_row order_tenant)
RETURNS text
LANGUAGE sql
STABLE
AS $function$
SELECT to_char(nextval('unique_order_tenant_no_sequence'), 'FM000000') || order_item_row.id::text;
$function$
```

Basically it get id parameter and combine it with uniqe sequence value. I can query it via graphql query but filter does not work.

Here screenshot without filtering, I can query order_tenant_no
![image](https://github.com/hasura/graphql-engine/assets/40808896/29b1df23-5c86-4578-b73f-7dcd83cf6261)

It does not work via filtering:

![image](https://github.com/hasura/graphql-engine/assets/40808896/ec89e0a7-924e-4877-a47a-9b1951e1094c)

any help or suggestion ?

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Start by reproducing the reported GraphQL query with a filter on the order_tenant computed field in Hasura Cloud, then trace how computed fields are handled during filtering. Done means the field remains queryable and filtering returns the expected records.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, postgresql, sql
Domain
api, backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.