Project

General

Profile

« Previous | Next » 

Revision 2297

sql.py: put_table(): Order selects by in_tables0's pkey to avoid undefined orderings on multiple runs of the same query

View differences:

sql.py
757 757
    distinct_on = []
758 758
    def mk_main_select(cols):
759 759
        return mk_select(db, insert_joins, cols, conds, distinct_on,
760
            order_by=None, limit=limit, start=start, default_table=in_tables0)
760
            limit=limit, start=start, default_table=in_tables0)
761 761
    
762 762
    def log_ignore(in_col, value):
763 763
        db.log_debug('Ignoring rows with '+in_col+' = '+value)
......
773 773
                select_joins = insert_joins+[sql_gen.Join(out_table, join_cols)]
774 774
                db.log_debug('Getting pkeys of already existing rows')
775 775
                run_query_into_pkeys(*mk_select(db, select_joins, pkeys_cols,
776
                    order_by=None, start=0))
776
                    start=0))
777 777
                
778 778
                # Prepare to insert new rows
779 779
                input_join_cols = join_cols.values()
......
814 814
            except KeyError: # no mapping for missing col, so every row invalid
815 815
                db.log_debug('Missing mapping for '+out_col)
816 816
                run_query_into_pkeys(*mk_select(db, insert_joins,
817
                    [in_pkey_col, sql_gen.NamedCode(out_pkey, None)],
818
                    order_by=None, start=0))
817
                    [in_pkey_col, sql_gen.NamedCode(out_pkey, None)], start=0))
819 818
                break
820 819
            else:
821 820
                log_ignore(in_col, 'NULL')

Also available in: Unified diff