这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@rakeshkky
Copy link
Member

@rakeshkky rakeshkky commented Oct 3, 2019

Description

Fixes bug related to SQL generation while more than one aggregate order_by of different array relationships present in the query. For more details refer to issue #2981

Affected components

  • Server
  • Tests

Related Issues

fix #2981

Solution and Design

In select SQL generation, all order_by s are marked with field name order_by. So, two aggregate order_bys from different array relationships are treated the same and their subqueries are merged. Hence, postgres query error is being thrown.

This PR generates order_by field names as <relationshp-name>.order_by to distinguish between different relationships.

Steps to test and verify

Follow the reproduction given in #2981 and make sure the query passes through

Limitations, known bugs & workarounds

N/A

@rakeshkky rakeshkky added the c/server Related to server label Oct 3, 2019
@rakeshkky rakeshkky requested a review from lexi-lambda as a code owner October 3, 2019 11:52
@rakeshkky rakeshkky self-assigned this Oct 3, 2019
@netlify
Copy link

netlify bot commented Oct 3, 2019

Deploy preview for hasura-docs ready!

Built with commit b6c07fd

https://deploy-preview-2998--hasura-docs.netlify.com

@rakeshkky rakeshkky changed the title fix SQL generation if more than one aggregate order_by of different array relationships present (close #2981) fix order by with multiple aggregate fields from different array relationships (close #2981) Oct 3, 2019
@hasura-bot
Copy link
Contributor

Review app for commit ced467e deployed to Heroku: https://hge-ci-pull-2998.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2998-ced467e8

@rakeshkky rakeshkky added the e/quickfix can be wrapped up in few hours label Oct 3, 2019
@hasura-bot
Copy link
Contributor

Review app for commit 47819b5 deployed to Heroku: https://hge-ci-pull-2998.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2998-47819b53

@hasura-bot
Copy link
Contributor

Review app for commit 4c9bb58 deployed to Heroku: https://hge-ci-pull-2998.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2998-4c9bb587

@shahidhk shahidhk changed the title fix order by with multiple aggregate fields from different array relationships (close #2981) add relationship name to generated order_by field names (close #2981) Oct 4, 2019
@shahidhk shahidhk changed the title add relationship name to generated order_by field names (close #2981) add relationship name to generated order_by field names (fix #2981) Oct 4, 2019
@hasura-bot
Copy link
Contributor

Review app for commit b6c07fd deployed to Heroku: https://hge-ci-pull-2998.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2998-b6c07fdc

@lexi-lambda lexi-lambda merged commit 084439d into hasura:master Oct 5, 2019
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-2998.herokuapp.com is deleted

polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server e/quickfix can be wrapped up in few hours

Projects

None yet

Development

Successfully merging this pull request may close these issues.

order by with multiple aggregate fields throws error

4 participants