Ticket #7600: operations.patch

File operations.patch, 975 bytes (added by shaun cutts <shaun@…>, 16 years ago)
  • usr/local/share/django-trunk/django/db/backends/postgresql/operations.py

     
    9797            # Use `coalesce` to set the sequence for each model to the max pk value if there are records,
    9898            # or 1 if there are none. Set the `is_called` property (the third argument to `setval`) to true
    9999            # 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:
    101101                if isinstance(f, models.AutoField):
    102102                    output.append("%s setval('%s', coalesce(max(%s), 1), max(%s) %s null) %s %s;" % \
    103103                        (style.SQL_KEYWORD('SELECT'),
Back to Top