From 116faee662f618d5ecd13b1e074a27d5e5a40564 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Fri, 12 Jul 2019 22:43:31 -0400 Subject: self_group() for FunctionFilter Fixed issue where the :class:`.array_agg` construct in combination with :meth:`.FunctionElement.filter` would not produce the correct operator precedence between the FILTER keyword and the array index operator. Fixes: #4760 Change-Id: Ic662cd3da3330554ec673bafd80495b3f1506098 --- lib/sqlalchemy/sql/elements.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/sqlalchemy/sql/elements.py') diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 735a125d7..6d1174d20 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -3808,6 +3808,12 @@ class FunctionFilter(ColumnElement): rows=rows, ) + def self_group(self, against=None): + if operators.is_precedent(operators.filter_op, against): + return Grouping(self) + else: + return self + @util.memoized_property def type(self): return self.func.type -- cgit v1.2.1