Project

General

Profile

« Previous | Next » 

Revision 3002

sql.py: add_index(): Fixed bug where expr could not be deep-copied until ensure_not_null() had been run on it, because ensure_not_null() modifies the index_cols of the table and this needs to be modified on the original table

View differences:

lib/sql.py
948 948
    exprs = []
949 949
    cols = []
950 950
    for i, expr in enumerate(old_exprs):
951
        expr = copy.deepcopy(expr) # don't modify input!
952 951
        expr = sql_gen.as_Col(expr, table)
953 952
        
954 953
        # Handle nullable columns
......
957 956
            except KeyError: pass # unknown type, so just create plain index
958 957
        
959 958
        # Extract col
959
        expr = copy.deepcopy(expr) # don't modify input!
960 960
        if isinstance(expr, sql_gen.FunctionCall):
961 961
            col = expr.args[0]
962 962
            expr = sql_gen.Expr(expr)
......
1016 1016
    add_index(db, new_col)
1017 1017
    
1018 1018
    col.table.index_cols[col.name] = new_col
1019
    import sys;print >>sys.stderr,'>>>>1'+repr(col.table)+repr(col.table.index_cols)
1019 1020

  
1020 1021
def ensure_not_null(db, col):
1021 1022
    '''For params, see sql_gen.ensure_not_null()'''

Also available in: Unified diff