Hi Everyone,

Has anyone else run across this?  I tried to enter it as
a ticket at: 

 http://code.djangoproject.com/simpleticket

but was mistaken for a spammer.  ;-)

Django versions 1.0.x through 1.1 alpha 1, PostgreSQL 8.3.5,
Python 2.5.2

django/contrib/auth/models.py

I have long model names.  I am aware that postgresql has a 128
character limit for tables.  I don't think there is any
practical limit in python to a class name's length.

My problem is:

The definition of the name and codename fields within the
Permission model specify 50 and 100 character limits, 
respectively.

For an app that has a model name of
AgreementGeographicBoundaryApplicability,
the permission name becomes:

Can change agreement geographic boundary applicability

which is 55 characters and generates a database overflow error
(shown below).  I can easily fix this by changing the max_length 
values both to 255 (in the installed source code and the database) 
to overcome this.   Should I be doing this?  If so, can these values
be bumped up in the official release?

I.e. change the Permission class' field definitions to:
{{{
    name = models.CharField(_('name'), max_length=255)
    content_type = models.ForeignKey(ContentType)
    codename = models.CharField(_('codename'), max_length=255)

}}}

running manage.py test
{{{ 
Creating table pdf_...
Permission generation starts next:
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.
py", line 350, in execute_manager
    utility.execute()
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.
py", line 295, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 222, in execute
    output = self.handle(*args, **options)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/commands/
test.py", line 30, in handle
    failures = test_runner(test_labels, verbosity=verbosity,
interactive=interactive)
  File "/usr/local/lib/python2.5/site-packages/django/test/simple.py",
line 191, in run_tests
    connection.creation.create_test_db(verbosity, autoclobber=not
interactive)
  File
"/usr/local/lib/python2.5/site-packages/django/db/backends/creation.py",
line 316, in create_test_db
    call_command('syncdb', verbosity=verbosity, interactive=False)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/__init__.
py", line 158, in call_command
    return klass.execute(*args, **options)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 222, in execute
    output = self.handle(*args, **options)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/base.py",
line 351, in handle
    return self.handle_noargs(**options)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/commands/
syncdb.py", line 98, in handle_noargs
    emit_post_sync_signal(created_models, verbosity, interactive)
  File
"/usr/local/lib/python2.5/site-packages/django/core/management/sql.py",
line 205, in emit_post_sync_signal
    interactive=interactive)
  File
"/usr/local/lib/python2.5/site-packages/django/dispatch/dispatcher.py",
line 148, in send
    response = receiver(signal=self, sender=sender, **named)
  File
"/usr/local/lib/python2.5/site-packages/django/contrib/auth/management/_
_init__.py", line 28, in create_permissions
    defaults={'name': name, 'content_type': ctype})
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/manager.py",
line 96, in get_or_create
    return self.get_query_set().get_or_create(**kwargs)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/query.py", line
372, in get_or_create
    obj.save(force_insert=True)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/base.py", line
328, in save
    self.save_base(force_insert=force_insert, force_update=force_update)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/base.py", line
400, in save_base
    result = manager._insert(values, return_id=update_pk)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/manager.py",
line 144, in _insert
    return insert_query(self.model, values, **kwargs)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/query.py", line
1033, in insert_query
    return query.execute_sql(return_id)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/sql/subqueries.
py", line 317, in execute_sql
    cursor = super(InsertQuery, self).execute_sql(None)
  File
"/usr/local/lib/python2.5/site-packages/django/db/models/sql/query.py",
line 2020, in execute_sql
    cursor.execute(sql, params)
psycopg2.DataError: value too long for type character varying(50)

}}}

Thanks for any pointers.
Mark

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to