self._correlator = Select._CorrelatedVisitor(self, False)
self._wherecorrelator = Select._CorrelatedVisitor(self, True)
+
self.group_by(*(group_by or [None]))
self.order_by(*(order_by or [None]))
def _locate_oid_column(self):
for f in self._froms.values():
if f is self:
- # TODO: why would we be in our own _froms list ?
- raise exceptions.AssertionError("Select statement should not be in its own _froms list")
+ # we might be in our own _froms list if a column with us as the parent is attached,
+ # which includes textual columns.
+ continue
oid = f.oid_column
if oid is not None:
return oid
s.append_from("table1")
self.runtest(s, "SELECT column1, column2 FROM table1 WHERE column1=12 AND column2=19 ORDER BY column1")
+ def testtextcolumns(self):
+ self.runtest(
+ select(["column1", "column2"], from_obj=[table1]).alias('somealias').select(),
+ "SELECT somealias.column1, somealias.column2 FROM (SELECT column1, column2 FROM mytable) AS somealias"
+ )
def testtextbinds(self):
self.runtest(
text("select * from foo where lala=:bar and hoho=:whee"),