Skip to content

Commit

Permalink
generic expression aggregation check all children are -> any child is (
Browse files Browse the repository at this point in the history
…#482)

* generic expression aggregation check all children are -> any child is

changes the generic logic checking if an expression is an aggregation to just checking if there is any child which aggregates rather than all children aggregating

* values are aggregations

* fix make check

* remove now incorrect test

* cov

* fix check

* trying to fix parse error
  • Loading branch information
CircArgs committed Apr 28, 2023
1 parent 810c4bf commit 5843d14
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dj/sql/parsing/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,9 @@ class Value(Expression):
Base class for all values number, string, boolean
"""

def is_aggregation(self) -> bool:
return True


@dataclass(eq=False)
class Null(Value):
Expand Down
4 changes: 3 additions & 1 deletion tests/models/node_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def test_extra_validation() -> None:
type=node.type,
node=node,
version="1",
query="SELECT 42",
query="SELECT count(repair_order_id) + "
"repair_order_id AS num_repair_orders "
"FROM repair_orders",
)
with pytest.raises(Exception) as excinfo:
node_revision.extra_validation()
Expand Down

0 comments on commit 5843d14

Please sign in to comment.