Project

General

Profile

« Previous | Next » 

Revision 6801

sql_io.py: put_table(): is_function: Fixed bug where need to add the pkeys table's test pkey constraint after the data is added rather than when the empty table is created, to avoid adding a pkey constraint that will later be violated by data which returns multiple output rows for an input row (such as calls to _split())

View differences:

lib/sql_io.py
613 613
                    
614 614
                    # Create empty pkeys table so its row type can be used
615 615
                    insert_into_pkeys(sql.mk_select(db, input_joins,
616
                        [in_pkey_col, func_call], limit=0), recover=True)
616
                        [in_pkey_col, func_call], limit=0), add_pkey_=False,
617
                        recover=True)
617 618
                    result_type = db.col_info(sql_gen.Col(into_out_pkey,
618 619
                        into)).type
619 620
                    
......
649 650
                    log_debug('Calling function')
650 651
                    insert_into_pkeys(sql.mk_select(db, wrapper_table,
651 652
                        order_by=None), recover=True, cacheable=False)
653
                    sql.add_pkey_or_index(db, into, warn=True)
652 654
            else:
653 655
                cur = sql.insert_select(db, out_table, mapping.keys(),
654 656
                    main_select, **insert_args)

Also available in: Unified diff