Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: native query relationship in filter expression not working (v2) #10607

Open
meetzaveri opened this issue Nov 20, 2024 · 0 comments
Open
Labels
k/bug Something isn't working

Comments

@meetzaveri
Copy link
Member

Version Information

Server Version: 2.44

Environment

Cloud

What is the current behaviour?

Assume there exists a relationship between table and a native query. Please refer this doc for example.

Now If user uses native query (nested object) in where clause as part of filter expression, it will throw error. Without including it in where clause it works fine.

Query

query MyQuery {
  episodes(where: {podcasts: {title: {_ilike: "Episode 2"}}}) {
    podcasts {
      title
      podcast_id
    }
    title
  }
}

Response

{
  "errors": [
    {
      "message": "Internal Server Error",
      "extensions": {
        "path": "$",
        "code": "unexpected",
        "internal": {
          "error": "translateBoolExp RelTargetNativeQuery"
        }
      }
    }
  ]
}

What is the expected behaviour?

There is a limitation in hasura where we don't support boolean expressions across relationships to Native Queries, however we include them in the schema as shown here in the screenshot. This means we should either

  • work on feature support for having boolean expressions across relationships to Native queries
  • OR don't show Native query relationship field in where clause hence as part of GQL schema (based on introspection)

How to reproduce the issue?

  1. Add database and track some tables which you want to expose as part of GraphQL API
  2. Create a Native Query
  3. Add a relationship between table and Native Query as per this doc
  4. Perform a GQL query with root field of tracked table and include NQ (nested object) in where clause

Screenshots or Screencast

Screenshot 2024-11-18 at 6 37 48 PM

Any possible solutions/workarounds you're aware of?

Only workaround is to not use where clause if you are selecting Native query relationship(nested object) as part of filter operation. But this can also be part of feature request since this is a known limitation.

Keywords

Native Queries Filter Relationship

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant