Project

General

Profile

« Previous | Next » 

Revision 2328

sql.py: mk_insert_select(): Fixed bug where table for creating the returning column Col object was the already-escaped string, instead of the Table object

View differences:

sql.py
505 505
        Warning: If you set this and cacheable=True when the query is run, the
506 506
        query will be fully cached, not just if it raises an exception.
507 507
    '''
508
    table = sql_gen.as_Table(table).to_str(db)
508
    table = sql_gen.as_Table(table)
509 509
    if cols == []: cols = None # no cols (all defaults) = unknown col names
510 510
    if cols != None: cols = [sql_gen.as_Col(v).to_str(db) for v in cols]
511 511
    if select_query == None: select_query = 'DEFAULT VALUES'
512 512
    if returning != None: returning = sql_gen.as_Col(returning, table)
513 513
    
514 514
    # Build query
515
    query = 'INSERT INTO '+table
515
    query = 'INSERT INTO '+table.to_str(db)
516 516
    if cols != None: query += ' ('+', '.join(cols)+')'
517 517
    query += ' '+select_query
518 518
    
......
526 526
        assert returning != None
527 527
        
528 528
        # Create function
529
        function_name = '_'.join(map(clean_name, ['insert', table] + cols))
529
        function_name = '_'.join(map(clean_name, ['insert', table.name] + cols))
530 530
        return_type = 'SETOF '+returning.to_str(db)+'%TYPE'
531 531
        while True:
532 532
            try:

Also available in: Unified diff