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 17785,PostgreSQL Introspection: get_relations() broken after drop column,Thomas Güttler,nobody,"Hi, if a column gets dropped postgreSQL does not update the attnum of columns which have a higher attnum: {{{ # oid: select oid from pg_class where relname='modwork_buchungskreis'; modwork_eins_d=> select attrelid, attname, atttypid, attnum from pg_attribute where attrelid = 149923 order by attnum; attrelid | attname | atttypid | attnum ----------+------------------------------+----------+-------- 149923 | tableoid | 26 | -7 149923 | cmax | 29 | -6 149923 | xmax | 28 | -5 149923 | cmin | 29 | -4 149923 | xmin | 28 | -3 149923 | ctid | 27 | -1 149923 | id | 1043 | 1 149923 | name | 1043 | 2 149923 | ........pg.dropped.3........ | 0 | 3 149923 | ........pg.dropped.4........ | 0 | 4 149923 | default | 16 | 5 149923 | beschreibung | 1043 | 6 149923 | archiv | 1043 | 7 149923 | email_sender_id | 1043 | 8 }}} BTW, the same bug is in django/db/backends/postgresql/introspection.py Patch attached. I think it is overkill to write a unittest for this. Please let me know if you want a test. ",Bug,closed,"Database layer (models, ORM)",1.3,Normal,fixed,psycopg2 introspection,hv,Ready for checkin,1,0,0,0,0,0