This test is comparable to the first test `test_where_with_relation` in #10366