counts[i] = Submission.objects.all().filter(status__exact=str(i)).count() If you really intended status to be an integer, you might prefer to alter your table to make the column the right type. The alter table command required is beyond my sql confidence.
Older postgresql and lots of other databases will automatically cast things that look like integers to integers if needed for comparison, but newer postgresql, and probably others, in time, require you to say what you mean, and this is probably a (tm) good thing, in that the automatic casting hides subtle bugs that are hard to find. Or you could downgrade postgresql if you like. But eventually you're likely to want some new feature, so fixing your column seems to me the right thing. Bill On Mon, Nov 23, 2009 at 1:17 PM, Some Guy <[email protected]> wrote: > Hi, > I was switching from sqlite3 to postgres, the data was imported ok. > But now certain view queries are failing. i.e. > > counts[i] = Submission.objects.all().filter(status__exact=i).count() > > fails with ... > > File "/usr/lib/python2.5/site-packages/django/db/models/sql/query.py", > line 2369, in execute_sql > cursor.execute(sql, params) > > ProgrammingError: operator does not exist: character varying = integer > LINE 1: ...ons_submission" WHERE "submissions_submission"."status" = > 0 > ^ > HINT: No operator matches the given name and argument type(s). You > might need to add explicit type casts. > > using postgres 8.3. any advise would help. including up/downgrading > postgres (seems to be a lot of issues on the trac, is 8.3 even > supported?) > > -- > > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=.

