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

Conversation

@ajeetdsouza
Copy link
Contributor

@ajeetdsouza ajeetdsouza commented Jun 17, 2019

Currently, we allow tracking of a table with the same name as an already tracked function, and vice-versa. This causes an issue when querying from GraphQL since it will only query the table and not the function. I've made changes to disallow this by throwing an error.

Affected components

  • Server
  • Tests

Related Issues

#2020

Solution and Design

I've added a condition in the phase 1 functions trackFunctionP1 and trackTableP1 to check if a function/table by the same name already exists, and to throw an error if this is true.

Steps to test and verify

I've also added pytests in the TestTrackTables class.

Limitations, known bugs & workarounds

None

To the Reviewer (Server)

  • No new modules have been added.
  • trackFunctionP1 and trackExistingTableOrViewP1 now check if a functions or table with the same name is already being tracked.
  • QualifiedObject is now an instance of Functor
  • Tests have been added in TestTrackTables

Critical modules

  • src-lib/Hasura/RQL/DDL/Schema/Function.hs
  • src-lib/Hasura/RQL/DDL/Schema/Table.hs
  • tests-py/test_v1_queries.py (TestTrackTables and the corresponding tests)

@ajeetdsouza ajeetdsouza requested a review from rakeshkky June 17, 2019 11:00
@ajeetdsouza ajeetdsouza requested a review from 0x777 as a code owner June 17, 2019 11:00
@hasura-bot
Copy link
Contributor

Beep boop! 🤖

Hey @ajeetdsouza, thanks for your PR!

One of my human friends will review this PR and get back to you as soon as possible. 🕐

Stay awesome! 😎

@netlify
Copy link

netlify bot commented Jun 17, 2019

Deploy preview for hasura-docs ready!

Built with commit 674165f

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

@ajeetdsouza ajeetdsouza self-assigned this Jun 17, 2019
@ajeetdsouza ajeetdsouza added the c/server Related to server label Jun 17, 2019
@rakeshkky rakeshkky changed the title Do not allow tracking of table and function with same name (close #2020) do not allow tracking a table with the same name of a function and vice-versa (close #2020) Jun 20, 2019
@hasura-bot
Copy link
Contributor

Review app for commit d69b6e4 deployed to Heroku: https://hge-ci-pull-2383.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2383-d69b6e44

@hasura-bot
Copy link
Contributor

Review app for commit 7010c87 deployed to Heroku: https://hge-ci-pull-2383.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2383-7010c87d

Copy link
Member

@shahidhk shahidhk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hasura-bot
Copy link
Contributor

Review app for commit 674165f deployed to Heroku: https://hge-ci-pull-2383.herokuapp.com
Docker image for server: hasura/graphql-engine:pull2383-674165f7

@shahidhk shahidhk changed the title do not allow tracking a table with the same name of a function and vice-versa (close #2020) throw error when table with same name as a function is tracked (close #2020) Jul 11, 2019
@shahidhk shahidhk changed the title throw error when table with same name as a function is tracked (close #2020) throw error when tracking table/function if there are conflicts (close #2020) Jul 11, 2019
@shahidhk shahidhk merged commit 605f863 into hasura:master Jul 11, 2019
@hasura-bot
Copy link
Contributor

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

@hasura-bot
Copy link
Contributor

Beep boop! 🤖

GIF

Awesome work @ajeetdsouza! All of us at Hasura ❤️ what you did.

Thanks again 🤗

polRk pushed a commit to polRk/graphql-engine that referenced this pull request Feb 12, 2020
hasura#2383)

Currently, we allow tracking of a table with the same name as an already tracked function, and vice-versa. This causes an issue when querying from GraphQL since it will only query the table and not the function. I've made changes to disallow this by throwing an error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants