Ticket #7783: pgnulls.diff
File pgnulls.diff, 1022 bytes (added by , 16 years ago) |
---|
-
django/db/backends/postgresql_psycopg2/introspection.py
15 15 16 16 def get_table_description(cursor, table_name): 17 17 "Returns a description of the table, with the DB-API cursor.description interface." 18 cursor.execute("SELECT * FROM %s LIMIT 1" % quote_name(table_name)) 19 return cursor.description 18 cursor.execute("SELECT column_name, is_nullable FROM information_schema.columns WHERE table_name = '%s'" % table_name) 19 nullmap = dict(cursor.fetchall()) 20 cursor.execute("SELECT * FROM %s WHERE 1=0" % quote_name(table_name)) 21 def fixdesc(row,nullmap=nullmap): 22 ret = list(row) 23 ret[6] = nullmap[unicode(ret[0])] == u'YES' 24 return tuple(ret) 25 return map(fixdesc, cursor.description) 20 26 21 27 def get_relations(cursor, table_name): 22 28 """