Parenthesizing non-associative set-functions

Issue #623 resolved
Former user created an issue

0.3.8 introduced _Grouping as a way to apply parenthesises to clauses, obsoleting the parens-keyword. (See #247) This makes it hard to nest set-functions that aren't associative (EXCEPT is not associative, nor is UNION associative with UNION ALL)

One workaround might be to make the whole thing a subselect (adding .alias('foo').select() to the inner except in test_except_style3 makes the test succeed) This seems to be necessary for SQLite, where parenthesises suffice in PostgreSQL. (For the same reason commented in #247) However, this workaround becomes quite tedious if you're nesting set-operations of arbitrary selects that may or may not be set operations themselves. Ideally, except_(), union() and others should add whatever parenthesises (for PostgreSQL) and/or make a sub-select of it (SQLite) as needed.

Comments (3)

  1. Log in to comment