﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
26183	PostgreSQL backend: TimeField is created without time zone	Stefan Heinemann	nobody	"The documentation states that ""The PostgreSQL backend stores datetimes as timestamp with time zone."" 
Sadly, it does not do that with the TimeField, which can easily be seen in db/backend/postgres_psycopg2/base.py line 97. In my opinion, it would be nice to have the same behaviour for both the DateTimeField and the TimeField.

It's easy to change this line to

{{{
        'TimeField': 'time with time zone'
}}}

which does work. But there is a problem: 
I wanted to do a pull request so I changed the line. Now I had problems with my migrations file, since I have one that alters a field from TimeField (which was now ""with time zone"") to a interval. Postgres does not like that and throws

{{{
	django.db.utils.ProgrammingError: column ""duration"" cannot be cast automatically to type interval
	HINT:  You might need to specify ""USING duration::interval"".
}}}

So I did that and executed, by hand:

{{{
	ALTER TABLE ""resource_check_testtyperesourcetype"" ALTER COLUMN ""duration"" TYPE interval USING duration::interval;
}}}

Now it says: '''ERROR:  cannot cast type time with time zone to interval at character 103'''

So now I'm not sure if it is even a good idea to change the default behaviour of TimeField to ""with time zone""...."	Bug	closed	Database layer (models, ORM)	1.8	Normal	wontfix	postgres, timezone, time field		Unreviewed	0	0	0	0	0	0
