Ticket #7600: operations.patch
File operations.patch, 975 bytes (added by , 16 years ago) |
---|
-
usr/local/share/django-trunk/django/db/backends/postgresql/operations.py
97 97 # Use `coalesce` to set the sequence for each model to the max pk value if there are records, 98 98 # or 1 if there are none. Set the `is_called` property (the third argument to `setval`) to true 99 99 # if there are records (as the max pk value is already in use), otherwise set it to false. 100 for f in model._meta. fields:100 for f in model._meta.local_fields: 101 101 if isinstance(f, models.AutoField): 102 102 output.append("%s setval('%s', coalesce(max(%s), 1), max(%s) %s null) %s %s;" % \ 103 103 (style.SQL_KEYWORD('SELECT'),