Changes between Initial Version and Version 1 of Ticket #23541


Ignore:
Timestamp:
Sep 22, 2014, 9:24:41 PM (10 years ago)
Author:
Aryeh Hillman
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #23541 – Description

    initial v1  
    331. Install this function at a shell for PostgreSQL
    44
    5 ```CREATE FUNCTION exec(text) returns text language plpgsql volatile
     5{{{CREATE FUNCTION exec(text) returns text language plpgsql volatile
    66  AS $f$
    77    BEGIN
     
    99      RETURN $1;
    1010    END;
    11 $f$;```
     11$f$;}}}
    1212
    1313source: http://wiki.postgresql.org/wiki/Dynamic_DDL
     
    15152. Write a RunSQL operation to help rename some tables
    1616
    17 ```class Migration(migrations.Migration):
     17{{{class Migration(migrations.Migration):
    1818...
    1919    operations = [
     
    2424            sql="""select exec(format('alter table %I rename to %I', tablename, regexp_replace(tablename, '^hello, 'goodbye'))) from pg_tables where tablename like 'hello%';"""
    2525        ),
    26     ]```
     26    ]
     27...}}}
    2728
    28293. Run the migration. I got this error:
    2930
    30 ```Traceback (most recent call last):
     31{{{Traceback (most recent call last):
    3132  File "./manage.py", line 10, in <module>
    3233    execute_from_command_line(sys.argv)
     
    5556  File "/Users/abhillman/stable_env/lib/python2.7/site-packages/django/db/backends/utils.py", line 65, in execute
    5657    return self.cursor.execute(sql, params)
    57 IndexError: list index out of range```
     58IndexError: list index out of range}}}
    5859
    59 Not sure what's going on here. Could it be the custom function?
     60Not sure what's going on here. Could it be the custom PGSQL function?
Back to Top