Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value too long with postgresql #44

Open
nvbn opened this issue Nov 22, 2012 · 5 comments
Open

value too long with postgresql #44

nvbn opened this issue Nov 22, 2012 · 5 comments

Comments

@nvbn
Copy link

nvbn commented Nov 22, 2012

When i try to create the order, i saw:

/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/fields/__init__.py:808: RuntimeWarning: DateTimeField received a naive datetime (2012-11-23 02:53:29.456187) while time zone support is active.
  RuntimeWarning)

And that:

  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/plata/shop/forms.py", line 72, in save
    order.save()
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/plata/shop/models.py", line 172, in save
    super(Order, self).save(*args, **kwargs)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/base.py", line 463, in save
    self.save_base(using=using, force_insert=force_insert, force_update=force_update)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/base.py", line 551, in save_base
    result = manager._insert([self], fields=fields, return_id=update_pk, using=using, raw=raw)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/manager.py", line 203, in _insert
    return insert_query(self.model, objs, fields, **kwargs)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/query.py", line 1593, in insert_query
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 910, in execute_sql
    cursor.execute(sql, params)
  File "/home/nvbn/work/totemi/ENV/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py", line 52, in execute
    return self.cursor.execute(query, args)
DatabaseError: value too long for type character varying(3)
@matthiask
Copy link
Owner

What is the value of your CURRENCIES setting? And which countries are available in your shop? The country field only allows 3 characters; I mostly use django-countries, which stores only the ISO code and not the full country name.

@matthiask
Copy link
Owner

Please reopen if you have further information about this problem. Thanks!

@nvbn
Copy link
Author

nvbn commented Nov 26, 2012

CURRENCIES = ('RUS',)
And it works with mysql and sqlite, but not with postgresql.

@matthiask matthiask reopened this Nov 26, 2012
@matthiask
Copy link
Owner

This sounds like a discrepancy between byte and character counting. Which database encoding / charset are you using?

@nvbn
Copy link
Author

nvbn commented Nov 26, 2012

Encoding is ru_RU.UTF-8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants