Fixed bug in PostgreSQL dialect where compiler keyword arguments such as
``literal_binds=True`` were not being propagated to a DISTINCT ON
expression.
Fixes: #4325
Change-Id: I9949387dceb7fabe889799f42e92423572368b29
--- /dev/null
+.. change::
+ :tags: bug, postgresql
+ :tickets: 4325
+
+ Fixed bug in PostgreSQL dialect where compiler keyword arguments such as
+ ``literal_binds=True`` were not being propagated to a DISTINCT ON
+ expression.
return "DISTINCT "
elif isinstance(select._distinct, (list, tuple)):
return "DISTINCT ON (" + ', '.join(
- [self.process(col) for col in select._distinct]
+ [self.process(col, **kw) for col in select._distinct]
) + ") "
else:
return "DISTINCT ON (" + \
"SELECT DISTINCT ON (t.a) t.id, t.a, t.b FROM t"
)
+ def test_literal_binds(self):
+ self.assert_compile(
+ select([self.table]).distinct(self.table.c.a == 10),
+ "SELECT DISTINCT ON (t.a = 10) t.id, t.a, t.b FROM t",
+ literal_binds=True
+ )
+
def test_query_plain(self):
sess = Session()
self.assert_compile(