Opened 7 years ago

Closed 7 years ago

#4603 closed (duplicate)

Psycopg2 - error setting time zone

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


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."

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by Jonas

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset


postgresql-8.2 8.2.4-0ubuntu0.7.04

comment:2 Changed 7 years ago by mtredinnick

  • Resolution set to duplicate
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.