I changed my database from mysql to postgresql. But when I tried saving data on forms, I got this error " value too long for type character varying(50)" I don't know why, because when I was using MYSQL, I didn't get any error. Can someone help me with this Postgresql? On Monday, May 4, 2009 at 10:46:53 PM UTC+7 MS wrote:
> Hi, > > I have a problem with django+postgresql: > I have a model with a CharField(max_length=255) field, and I'm > assigning some much longer value to this field, like: > > m = MyModel() > m.myfield = 'very long text - say 400 chars' > m.save() > > In save() I'm getting an error "ERROR: value too long for type > character varying(255)", and the SQL statement contains the 'very long > text - say 400 chars' intact. > > I thought that if django knows that a field is restricted to 255 > chars, then it will validate it and > truncate excessive chars before saving. But it doesn't. How can I get > rid of that problem? > > Thanks, > MS > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a4bbb62c-1ad7-4ad8-a361-08cf71df47d6n%40googlegroups.com.

