From b0bc8b9dfd6069e53cd73c1d3411f995a05f0a5a Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Mon, 30 Jun 2008 00:38:14 +0000 Subject: Fixed #7565 -- Fixed a problem with PostgreSQL sequence resetting in loaddata. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7789 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/backends/postgresql/operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db/backends/postgresql/operations.py') diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 7e27b23f72..ba6e3235c2 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -97,7 +97,7 @@ class DatabaseOperations(BaseDatabaseOperations): # Use `coalesce` to set the sequence for each model to the max pk value if there are records, # or 1 if there are none. Set the `is_called` property (the third argument to `setval`) to true # if there are records (as the max pk value is already in use), otherwise set it to false. - for f in model._meta.fields: + for f in model._meta.local_fields: if isinstance(f, models.AutoField): output.append("%s setval('%s', coalesce(max(%s), 1), max(%s) %s null) %s %s;" % \ (style.SQL_KEYWORD('SELECT'), -- cgit v1.2.1