google-code-export / django-pyodbc

Automatically exported from code.google.com/p/django-pyodbc
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Cannot perform exact lookup on a BIGINT field #64

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Setup django + django-pyodbc + freetds + unixodbc
2. Create a table with a bigint field
3. Try to select on that field with django-pyodbc

What is the expected output? What do you see instead?
I expect to get a row returned, but instead I'm told an object matching the
query doesn't exist

What version of the product are you using? On what operating system?
Trunk build of django-pyodbc, latest CentOS FreeTDS + pyodbc packages, SQL
Server 2005

Please provide any additional information below.
The only way I can actually select on a bigint field is if I do a
__contains lookup instead of an exact lookup. I've tested the query
directly in pyodbc and it works fine, but when I try it in django, no
results are returned. I'm currently setting up CentOS 5.4 64-bit in
virtualbox where I plan to try and replicate the issue, but I was wondering
if anyone else has had this problem or knows where I can look.

It seems that either django-pyodbc or django itself turns my long integer
into a regular integer and that causes it to fail. Even if I specify the
lookup as a string, it's converted to a regular int. The model field is an
AutoField, but I've changed it to IntegerField as well with the same results.

Original issue reported on code.google.com by alex.vidal on 14 Dec 2009 at 5:25

GoogleCodeExporter commented 9 years ago
An AutoField in Django, as of 1.1, is always a 32-bit integer. 1.2 is adding a
BigintField, but I don't know if they're also adding a "BigAutoField" to match.

You might be interested in these classes:
http://code.google.com/p/django-mssql/source/browse/trunk/source/sqlserver_ado/f
ields.py

Original comment by fla...@gmail.com on 21 Dec 2009 at 5:50