Project

General

Profile

« Previous | Next » 

Revision 3292

sql_io.py: put_table(): Main insert: Don't run it inside an extra savepoint, because this will cause the creation of any helper SQL functions to be rolled back if an exception is thrown. If those functions are later re-used, the cache will think they exist when they no longer do. (Calling a function on input rows is now run in recover mode, so that it doesn't need the outer savepoint anymore.)

View differences:

sql_io.py
391 391
            main_select = mk_main_select([insert_in_table], [sql_gen.with_table(
392 392
                c, insert_in_table) for c in mapping.values()])
393 393
        
394
        def main_insert():
394
        try:
395
            cur = None
395 396
            if is_function:
396 397
                insert_into_pkeys(input_joins, [in_pkey_col, func_call],
397 398
                    recover=True)
398
                return None
399 399
            else:
400
                return sql.insert_select(db, out_table, mapping.keys(),
400
                cur = sql.insert_select(db, out_table, mapping.keys(),
401 401
                    main_select, **insert_args)
402
        
403
        try:
404
            cur = sql.with_savepoint(db, main_insert)
405 402
            break # insert successful
406 403
        except sql.MissingCastException, e:
407 404
            log_exc(e)

Also available in: Unified diff