django.db.utils.DatabaseError: value too long for type character varying(50)

597 views
Skip to first unread message

Valentin Golev

unread,
Sep 20, 2010, 10:51:30 AM9/20/10
to Django users
Hello,

I'm trying to deploy my Django application with PostgreSQL. While
trying to insert an object to the database, I'm getting the following
error:


django.db.utils.DatabaseError: value too long for type character
varying(50)


My application were working fine on SQLite. I guess it has something
to do with encoding (my data in in Cyrillic). I thought Django should
truncate in on the application level, but it obviously doesn't. What
can I do (except for truncating data by myself every time)?

James Rivett-Carnac

unread,
Jul 14, 2012, 2:53:03 AM7/14/12
to django...@googlegroups.com
An old post, but I just had the same problem.

James Rivett-Carnac

unread,
Jul 14, 2012, 3:44:03 AM7/14/12
to django...@googlegroups.com
Some more information:

I am getting this from the insertion of auth_permissions, in django/db/backends/postgresql_psycopg2/base.py, line 52

'INSERT INTO "auth_permission" ("name", "content_type_id", "codename") VALUES (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s), (%s, %s, %s)'

args is a long tupple of the create_x, add_x, modify_x and a couple custom permissions.  The longest string is 22 characters long.  Since nothing here is over 50 characters, is there something I'm missing.  I am also using django_guardian

james
Reply all
Reply to author
Forward
0 new messages