Project

General

Profile

« Previous | Next » 

Revision 5642

sql.py: mk_select(): Don't add table0 to order_by with no table, because this could cause it not to match a corresponding DISTINCT ON column with no explicit table. PostgreSQL apparently does not treat a column with no explicit table and a column with the applicable table as identical for purposes of ORDER BY/DISTINCT ON checking, even when they refer to the same physical column.

View differences:

lib/sql.py
765 765
        query += '\n'+sql_gen.combine_conds([sql_gen.ColValueCond(l, r)
766 766
            .to_str(db) for l, r in conds], 'WHERE')
767 767
    if order_by != None:
768
        query += '\nORDER BY '+sql_gen.as_Col(order_by, table0).to_str(db)
768
        query += '\nORDER BY '+sql_gen.as_Col(order_by).to_str(db)
769 769
    if limit != None: query += '\nLIMIT '+str(limit)
770 770
    if start != None:
771 771
        if start != 0: query += '\nOFFSET '+str(start)

Also available in: Unified diff