﻿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
35240	Django doesn't set Postgres timezone to UTC when using psycopg3	Fabi	nobody	"Configuration uses `USE_TZ=True` and database defaults to `America/New_York`. I would expect the connection then being set to UTC, but it is not changed:
{{{
In [4]: connections[""default""].cursor().connection.info.timezone
Out[4]: zoneinfo.ZoneInfo(key='America/New_York')
}}}

The wrapper and the psycopg3 timezone adapter both think its UTC though:
{{{
In [5]: connections[""default""].timezone
Out[5]: datetime.timezone.utc

In [6]: connections[""default""].cursor().connection.adapters.get_loader(TIMESTAMPTZ_OID, Format.TEXT).timezone
Out[6]: datetime.timezone.utc
}}}

Looking at the code I think the problem is that the adapter gets initialized with `self.timezone` which then gets compared with `self.timezone` later again, resulting in a no-op:
- https://github.com/django/django/blob/31314980be428c0ab8a6cf40cce0a0c17ead8ec6/django/db/backends/postgresql/base.py#L243-L246
- https://github.com/django/django/blob/31314980be428c0ab8a6cf40cce0a0c17ead8ec6/django/db/backends/postgresql/base.py#L349-L354
"	Bug	closed	Uncategorized	4.2	Normal	needsinfo		Fabi Mariusz Felisiak Florian Apolloner Simon Charette	Unreviewed	0	0	0	0	0	0
