Opened 11 years ago

Closed 11 years ago

#22304 closed Bug (duplicate)

permission creation during the migration raises data error

Reported by: secult@… Owned by: secult
Component: contrib.auth Version: 1.6
Severity: Normal Keywords: migration permission creation signal bug
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

A DataError raises while permissions are created.
I think there is a problem because of the long model names - the Permission model, while saved, is not validated against the db fields- mainly:

name models.CharField(_('name'), max_length=50)

that is easy to reach.

Traceback:

Running migrations for accounting:
 - Migrating forwards to 0053_auto__add_taxdecfirstattachmentmodel__add_taxdecsecondattachmentmodel_.
 > accounting:0053_auto__add_taxdecfirstattachmentmodel__add_taxdecsecondattachmentmodel_
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/south/management/commands/migrate.py", line 111, in handle
    ignore_ghosts = ignore_ghosts,
  File "/data/jedna_sest/local/lib/python2.7/site-packages/south/migration/__init__.py", line 220, in migrate_app
    success = migrator.migrate_many(target, workplan, database)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/south/migration/migrators.py", line 254, in migrate_many
    result = migrator.__class__.migrate_many(migrator, target, migrations, database)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/south/migration/migrators.py", line 335, in migrate_many
    interactive=self.interactive)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/south/db/generic.py", line 1030, in send_pending_create_signals
    interactive=interactive)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/south/db/generic.py", line 1076, in really_send_create_signal
    db=self.db_alias,
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/dispatch/dispatcher.py", line 185, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/contrib/auth/management/__init__.py", line 101, in create_permissions
    auth_app.Permission.objects.using(db).bulk_create(perms)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/models/query.py", line 356, in bulk_create
    self._batched_insert(objs_without_pk, fields, batch_size)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/models/query.py", line 835, in _batched_insert
    using=self.db)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/models/manager.py", line 232, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/models/query.py", line 1511, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 898, in execute_sql
    cursor.execute(sql, params)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/backends/util.py", line 69, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/data/jedna_sest/local/lib/python2.7/site-packages/django/db/backends/util.py", line 53, in execute
    return self.cursor.execute(sql, params)
django.db.utils.DataError: value too long for type character varying(50)

(Using South 0.8.4 but thats not important)

Change History (1)

comment:1 by Simon Charette, 11 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #8162.

Note: See TracTickets for help on using tickets.
Back to Top