Opened 12 years ago

Closed 12 years ago

#1823 closed defect (invalid)

set timezone in pgsql is not working right

Reported by: w4kpm@… Owned by: Adrian Holovaty
Component: contrib.admin Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by Adrian Holovaty)

set timezone command for postgres is currently "set time zone . . ." which crashes.

should be "set timezone to"

--- django/db/backends/postgresql/       (revision 2868)
+++ django/db/backends/postgresql/       (working copy)
@@ -39,7 +39,7 @@
             self.connection = Database.connect(conn_string)
             self.connection.set_isolation_level(1) # make transactions transparent to all cursors
         cursor = self.connection.cursor()
-        cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
+        cursor.execute("SET TIMEZONE %s", [settings.TIME_ZONE])
         if settings.DEBUG:
             return util.CursorDebugWrapper(cursor, self)
         return cursor


Change History (3)

comment:1 Changed 12 years ago by Adrian Holovaty

I'm wondering why this has worked, in its current form, for several years. Are you on a peculiar version of Postgres?

comment:2 Changed 12 years ago by Adrian Holovaty

Description: modified (diff)

Fixed description

comment:3 Changed 12 years ago by w4kpm@…

Resolution: invalid
Status: newclosed


Sorry for the annoyance,

When I was first going through the tutorial,
I had a problem (error) that showed the SET TIME ZONE in the error.

your syntax for set time zone works fine at the sql prompt.
Hitting tab-complete at the postgres prompt changes it to TIMEZONE which is what made me think that was the problem.

I have not been able to re-create so I'm going to mark resolved as 'stupid user error'


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