Opened 17 years ago

Closed 17 years ago

#4603 closed (duplicate)

Psycopg2 - error setting time zone

Reported by: Jonas von Poser Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords: postgresql psycopg2
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


There's a bug in Psycopg2 that doesn't let connect to the data base:

In [1]: from django.db import connection

In [2]: cursor = connection.cursor()
<class 'psycopg2.ProgrammingError'>       Traceback (most recent call last)

/home/*****/<ipython console> in <module>()

/usr/local/lib/python2.5/django/db/backends/postgresql_psycopg2/ in cursor(self)
     52         cursor.tzinfo_factory = None
     53         if set_tz:
---> 54             cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
     55         global postgres_version
     56         if not postgres_version:

<class 'psycopg2.ProgrammingError'>: argument formats can't be mixed

I found the same bug here:

"Please, also note that using lists as arguments is wrong. It works only by chance and would probably raise an error in the future. Use tuples or dictionaries."

Change History (2)

comment:1 by Jonas von Poser, 17 years ago


postgresql-8.2 8.2.4-0ubuntu0.7.04

comment:2 by Malcolm Tredinnick, 17 years ago

Resolution: duplicate
Status: newclosed

This is a dupe of #4099. What it will take for that to be fixed is somebody to go through everywhere we are passing paramaters to the database (in the psycopg2 backend) and check they are all tuples or dictionaries. If you could be bothered to do that (since you have the setup already) and attach a patch to the other ticket, that would be great.

Note: See TracTickets for help on using tickets.
Back to Top