id,summary,reporter,owner,description,type,status,component,version,severity,resolution,keywords,cc,stage,has_patch,needs_docs,needs_tests,needs_better_patch,easy,ui_ux 11074,syncdb should execute custom field SQL separately from initial model SQL,psmith,nobody,"Currently, if I have exception-throwing SQL in a /.sql file, this breaks GeoDjango's creation of geometry fields and indexes on ./manage.py syncdb. You wind up with a database table that has the regular Django fields but is missing geometry fields at the end of the syncdb command. This is because GeoDjango's field-specific post-table-creation SQL which actually creates the geometry fields (from the post_create_sql() hook) is lumped in with the initial model SQL. I am proposing that custom field post-table-creation SQL like GeoDjango emits and user-specified initial model SQL in *.sql files be run in separate transactions. Arguably if my custom initial model SQL is broken then I shouldn't expect syncdb to work cleanly. But it may be surprising that my probably unrelated initial model SQL leaves my GeoDjango model tables (or any model with a custom field that implements post_create_sql()) in an incomplete or undefined state because it happens to be executing in the same transaction as the custom field SQL. syncdb does charge ahead and create as much as possible despite exceptions, so I think one could argue that leaving the database in as consistent a state as possible despite errors is a decent goal.",Bug,closed,Core (Management commands),1.0,Normal,fixed,syncdb geodjango post_create_sql,,Accepted,1,0,1,0,0,0