liuyang1520 / django-command-extensions

Automatically exported from code.google.com/p/django-command-extensions
MIT License
0 stars 0 forks source link

sqldiff with postgresql can't get correct Decimal type from DB #78

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a model with a DecimalField(decimal_places=5, max_digits=15)
2. Run syncdb
3. Check with phpPgAdmin, that the correct field was created in the Database: 
numeric(15,5)
4. Run sqldiff on the model
5. You'll get: field 'mytestfield' parameters differ: db=numeric(15, 1), 
model=numeric(15, 5)

What is the expected output? What do you see instead?
The expected output is "nothing", meaning that no differences are found.

What version of the product are you using? On what operating system?
Newest revision from SVN, Django newest trunk

Please provide any additional information below.
I'm using PostgreSQL 8.3.5-0ubuntu0.8.04 from Ubuntu Hardy

Original issue reported on code.google.com by philipp....@gmail.com on 1 Feb 2009 at 1:41

GoogleCodeExporter commented 8 years ago
thanks for the report..
i'm very busy at the moment, i'll try and look at this as soon as i can.
it's likely missing the decimal_places part during introspection.
could be that this goes down to django's introspection module itself.

Original comment by v.oostv...@gmail.com on 1 Feb 2009 at 2:58

GoogleCodeExporter commented 8 years ago
I've tested this in a project of my own.. and it seems to work fine for me.
Using PostgreSQL-8.3(.5-0ubuntu8.10), latest django_extensions and lastest 
django-trunk.

Field in models.py::
    test = models.DecimalField(decimal_places=5, max_digits=15)

Yields no differences, when changed to decimal_places=6 yields::
|--+ field 'test' parameters differ: db=numeric(15, 5), model=numeric(15, 6)

Could you (double) check your project and otherwise upload a tarball with the 
problem
here ?

Thanks

Original comment by v.oostv...@gmail.com on 5 Feb 2009 at 10:05

GoogleCodeExporter commented 8 years ago
Hi,

I'm very sorry, it was a bug in the psycopg2 package provided by MacPorts. I 
installed the newest psycopg2 
using easy_install and now everything works as expected. :)

Philipp

Original comment by philipp....@gmail.com on 5 Feb 2009 at 10:49

GoogleCodeExporter commented 8 years ago
no problem :)

for future reference we now know that this can happen in 'crappy' psycopg2 
versions :)

Original comment by v.oostv...@gmail.com on 6 Feb 2009 at 9:00