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

support columns comparison on permission rules #2040

Closed
22mahmoud opened this issue Apr 20, 2019 · 4 comments
Closed

support columns comparison on permission rules #2040

22mahmoud opened this issue Apr 20, 2019 · 4 comments
Assignees
Labels
c/console Related to console e/intermediate can be wrapped up in a week k/enhancement New feature or improve an existing feature p/high candidate for being included in the upcoming sprint

Comments

@22mahmoud
Copy link

In my case, I have "bid" table has "amount" column and I want to check if that amount greater than the current "price" in the "auction" table.

expected query

{"auction":{"price":{"_lt":"current bid amount"}}}
@rakeshkky
Copy link
Member

Hi @22mahmoud, currently we do not have support for operators which work on columns of the same table. This is being tracked here.

A quick and dirty workaround is to use a view as follows:

create view bid_v as select u.*, (u.amount > u.price) as is_amount_greater from bid u;

Then you can query it as follows:

{
  bid_v(where: {is_amount_greater: {_eq: true}}) {
    amount
  }
}

@coco98
Copy link
Contributor

coco98 commented Apr 21, 2019

@rakeshkky Given the conversation with @22mahmoud on discord I think @22mahmoud wants to use it in a permission rule as a check constraint.

@coco98 coco98 reopened this Apr 21, 2019
@22mahmoud
Copy link
Author

as @coco98 said I want to use it in a permission rule as a check

@0x777
Copy link
Member

0x777 commented Apr 22, 2019

@rikinsk We already support column operators in permission definitions on server side, the operators are _ceq, _cne, _cgt, _clt, _cgte and _clte. We need to add these in the console?

@0x777 0x777 added c/console Related to console k/enhancement New feature or improve an existing feature labels Apr 22, 2019
@dsandip dsandip added p/high candidate for being included in the upcoming sprint p/urgent Immediate action required and removed p/high candidate for being included in the upcoming sprint labels May 13, 2019
@rikinsk-zz rikinsk-zz added p/high candidate for being included in the upcoming sprint and removed p/urgent Immediate action required labels May 22, 2019
@dsandip dsandip assigned rikinsk-zz and unassigned wawhal Jun 18, 2019
@rikinsk-zz rikinsk-zz added the e/intermediate can be wrapped up in a week label Jun 27, 2019
polRk pushed a commit to polRk/graphql-engine that referenced this issue Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/console Related to console e/intermediate can be wrapped up in a week k/enhancement New feature or improve an existing feature p/high candidate for being included in the upcoming sprint
Projects
None yet
Development

No branches or pull requests

7 participants