Project

General

Profile

« Previous | Next » 

Revision 2194

sql.py: When creating a temporary entity (table, function, etc.), instead create it as a permanent entity in debug mode so it can be viewed after the program is run

View differences:

lib/sql.py
371 371
        kw_args['recover'] = True
372 372
        while True:
373 373
            try:
374
                return run_query(db, 'CREATE TEMP TABLE '+into_ref[0]+' AS '
375
                    +query, params, *args, **kw_args)
374
                create_query = 'CREATE'
375
                if not db.debug: create_query += ' TEMP'
376
                create_query += ' TABLE '+into_ref[0]+' AS '+query
377
                
378
                return run_query(db, create_query, params, *args, **kw_args)
376 379
                    # CREATE TABLE AS sets rowcount to # rows in query
377 380
            except DuplicateTableException, e:
378 381
                into_ref[0] = next_version(into_ref[0])
......
545 548
        return_type = 'SETOF '+table+'.'+returning+'%TYPE'
546 549
        while True:
547 550
            try:
548
                function = 'pg_temp.'+function_name
551
                function = function_name
552
                if not db.debug: function = 'pg_temp.'+function
553
                
549 554
                function_query = '''\
550 555
CREATE FUNCTION '''+function+'''() RETURNS '''+return_type+'''
551 556
    LANGUAGE sql

Also available in: Unified diff