token_restriction: Add non-token merge exception

Add exception that is thrown when merging of token and non-token 
restrictions is attempted. Before this change only merging non-token
and token restriction was validated (WHERE pk = 0 AND token(pk) > 0)
and not the other way (WHERE token(pk) > 0 AND pk = 0).
This commit is contained in:
Piotr Grabowski
2020-10-15 11:52:52 +02:00
parent 71398f3fb4
commit 9d1cd2c57b

View File

@@ -71,6 +71,11 @@ public:
}
void merge_with(::shared_ptr<restriction> restriction) override {
if (!has_token(restriction->expression)) {
throw exceptions::invalid_request_exception(
format("Columns \"{}\" cannot be restricted by both a normal relation and a token relation",
join(", ", get_column_defs())));
}
expression = make_conjunction(std::move(expression), restriction->expression);
}