Project

General

Profile

« Previous | Next » 

Revision 5516

sql.py: mk_select(): order_by is order_by_pkey: Only order by the table's actual pkey, if it has one, rather than using the first column if it doesn't

View differences:

lib/sql.py
704 704
    assert limit == None or isinstance(limit, (int, long))
705 705
    assert start == None or isinstance(start, (int, long))
706 706
    if order_by is order_by_pkey:
707
        if table0 == None or distinct_on != []: order_by = None
708
        else: order_by = pkey_name(db, table0, recover=True)
707
        order_by = None
708
        if table0 != None and distinct_on == []:
709
            try: order_by = table_pkey_col(db, table0, recover=True)
710
            except DoesNotExistException: pass # no pkey to order by
709 711
    
710 712
    query = 'SELECT'
711 713
    

Also available in: Unified diff