- changed milestone to 1.2
negation of labeled element?
Issue #3969
resolved
this is technically something that semantically doesn't make sense, but in the "what I expect" category it does, which is to negate the inner element of a label.
from sqlalchemy import *
expr = or_(column('x') == 1, column('y') == 2)
bug = not_(expr.label('foo'))
from sqlalchemy.dialects import sqlite
print bug.compile()
print bug.compile(dialect=sqlite.dialect())
#!
NOT x = :x_1 OR y = :y_1
x = ? OR y = ? = 0
so the parenthesis are lost because we don't unwrap the label(), and we in fact hit a rule in ColumnElement._negate() where it assumes we're negating a true/false, so for a non-native-boolean it then sticks on "= 0" to the whole thing to make things worse.
Comments (2)
-
reporter -
reporter - changed status to resolved
Add _negate() to Label to negate inner element
Fixed the negation of a :class:
.Label
construct so that the inner element is negated correctly, when the :func:.not_
modifier is applied to the labeled expression.Change-Id: Ia99917b2959bdfbff28689c962b4203911c57b85 Fixes:
#3969→ <<cset 920f77e3c17e>>
- Log in to comment