- marked as critical
deeper check for "unique" non-match when clauses have been adapted
Issue #2425
resolved
quick demo:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Point(Base):
__tablename__ = 'point'
id = Column(Integer, primary_key=True)
flag = Column(Boolean, default=True)
coordinate_id = Column(Integer)
class Line(Base):
__tablename__ = 'line'
id = Column(Integer, primary_key=True)
start_point_id = Column(Integer, ForeignKey('point.id'))
start_point = relationship(
'Point',
primaryjoin=and_(
start_point_id==Point.id,
Point.flag == True
))
starts_one = Line.start_point.has()
starts_other = Line.start_point.has()
print and_(
starts_one, starts_other
)
here's the patch:
diff -r db69a48231754c4279b2ceb5ce7317a50ed839d2 lib/sqlalchemy/sql/compiler.py
--- a/lib/sqlalchemy/sql/compiler.py Thu Mar 08 00:51:49 2012 -0800
+++ b/lib/sqlalchemy/sql/compiler.py Thu Mar 08 14:35:35 2012 -0800
@@ -655,7 +655,8 @@
if name in self.binds:
existing = self.binds[name](name)
if existing is not bindparam:
- if existing.unique or bindparam.unique:
+ if (existing.unique or bindparam.unique) and \
+ not existing.proxy_set.intersection(bindparam.proxy_set):
raise exc.CompileError(
"Bind parameter '%s' conflicts with "
"unique bind parameter of the same name" %
Comments (3)
-
reporter -
reporter - changed status to resolved
-
reporter - removed milestone
Removing milestone: 0.7.6 (automated comment)
- Log in to comment