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"}}}
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
}
}
@rakeshkky Given the conversation with @22mahmoud on discord I think @22mahmoud wants to use it in a permission rule as a check constraint.
as @coco98 said I want to use it in a permission rule as a check
@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?
Most helpful comment
@rikinsk We already support column operators in permission definitions on server side, the operators are
_ceq,_cne,_cgt,_clt,_cgteand_clte. We need to add these in the console?