mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Fixed #29350 -- Fix get_primary_key_column() method in sqlite3 backend
Thanks Tim Graham and Mariusz Felisiak for the reviews.
This commit is contained in:
committed by
Claude Paroz
parent
6b3d292043
commit
30f8642f2e
@@ -192,9 +192,9 @@ class DatabaseIntrospection(BaseDatabaseIntrospection):
|
||||
fields_sql = create_sql[create_sql.index('(') + 1:create_sql.rindex(')')]
|
||||
for field_desc in fields_sql.split(','):
|
||||
field_desc = field_desc.strip()
|
||||
m = re.search('"(.*)".*PRIMARY KEY( AUTOINCREMENT)?', field_desc)
|
||||
m = re.match('(?:(?:["`\[])(.*)(?:["`\]])|(\w+)).*PRIMARY KEY.*', field_desc)
|
||||
if m:
|
||||
return m.groups()[0]
|
||||
return m.group(1) if m.group(1) else m.group(2)
|
||||
return None
|
||||
|
||||
def _table_info(self, cursor, name):
|
||||
|
||||
Reference in New Issue
Block a user