Django

Code

Show
Ignore:
Timestamp:
08/01/07 12:51:59 (1 year ago)
Author:
danderson
Message:

schema-evolution:
fixed postgresql constraint lookup after a table rename bug
pulled table renames into the backends
added postgresql unit tests

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/schema-evolution/django/db/backends/postgresql/introspection.py

    r5735 r5784  
    9898    unique_conname = None 
    9999    shared_unique_connames = set() 
    100     cursor.execute("select pg_constraint.conname, pg_constraint.contype, pg_attribute.attname from pg_constraint, pg_attribute where pg_constraint.conrelid=pg_attribute.attrelid and pg_attribute.attnum=any(pg_constraint.conkey) and pg_constraint.conname~'^%s'" % table_name ) 
     100    cursor.execute("select pg_constraint.conname, pg_constraint.contype, pg_attribute.attname from pg_constraint, pg_attribute, pg_class where pg_constraint.conrelid=pg_class.oid and pg_constraint.conrelid=pg_attribute.attrelid and pg_attribute.attnum=any(pg_constraint.conkey) and pg_class.relname='%s'" % table_name ) 
    101101    for row in cursor.fetchall(): 
     102#        print row 
    102103        if row[2] == column_name: 
    103104            if row[1]=='p': dict['primary_key'] = True