From 994fa7780d73f6d618dc3a03339e96b5353b4e71 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Sun, 15 Mar 2026 00:04:26 +0100 Subject: [PATCH 1/2] Fixed #36960 -- Enabled the use of psycopg 3's optimized timestamp loader. Based on Daniele Varrazzo's comment in https://github.com/psycopg/psycopg/issues/1273#issuecomment-3986829769 --- django/db/backends/postgresql/psycopg_any.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/django/db/backends/postgresql/psycopg_any.py b/django/db/backends/postgresql/psycopg_any.py index dea4800fce7e..b877afc68062 100644 --- a/django/db/backends/postgresql/psycopg_any.py +++ b/django/db/backends/postgresql/psycopg_any.py @@ -2,9 +2,8 @@ from functools import lru_cache try: - from psycopg import ClientCursor, IsolationLevel, adapt, adapters, errors, sql + from psycopg import ClientCursor, IsolationLevel, adapt, adapters, errors, pq, sql from psycopg.postgres import types - from psycopg.types.datetime import TimestamptzLoader from psycopg.types.json import Jsonb from psycopg.types.range import Range, RangeDumper from psycopg.types.string import TextLoader @@ -16,13 +15,17 @@ TSRANGE_OID = types["tsrange"].oid TSTZRANGE_OID = types["tstzrange"].oid + orig_tz_loader_cls = adapters.get_loader( + types["timestamptz"].oid, + pq.Format.TEXT, + ) def mogrify(sql, params, connection): with connection.cursor() as cursor: return ClientCursor(cursor.connection).mogrify(sql, params) # Adapters. - class BaseTzLoader(TimestamptzLoader): + class BaseTzLoader(adapt.Loader): """ Load a PostgreSQL timestamptz using the a specific timezone. The timezone can be None too, in which case it will be chopped. @@ -30,9 +33,12 @@ class BaseTzLoader(TimestamptzLoader): timezone = None + def __init__(self, oid, context): + super().__init__(oid, context) + self.orig_loader = orig_tz_loader_cls(oid, context) + def load(self, data): - res = super().load(data) - return res.replace(tzinfo=self.timezone) + return self.orig_loader.load(data).replace(tzinfo=self.timezone) def register_tzloader(tz, context): class SpecificTzLoader(BaseTzLoader): From d9adcfbd5e3ba5859cc0ce6e2e67f533efbc8f9b Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Wed, 11 Mar 2026 11:35:26 +0000 Subject: [PATCH 2/2] Made it clear that unreviewed tickets shouldn't be claimed or started. --- docs/internals/contributing/triaging-tickets.txt | 4 ++++ .../contributing/writing-code/submitting-patches.txt | 11 +++++++---- docs/spelling_wordlist | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs/internals/contributing/triaging-tickets.txt b/docs/internals/contributing/triaging-tickets.txt index cb5ef6b20012..40b59c3f41ec 100644 --- a/docs/internals/contributing/triaging-tickets.txt +++ b/docs/internals/contributing/triaging-tickets.txt @@ -121,6 +121,10 @@ The ticket has not been reviewed by anyone who felt qualified to make a judgment about whether the ticket contained a valid issue or ought to be closed for any reasons. Unreviewed tickets appear in the "triage" queue. +Unreviewed tickets may receive additional refinement before being accepted. +Unless you are both the author of the ticket and intending to submit a patch, +unreviewed tickets should not be :ref:`claimed `. + Accepted -------- diff --git a/docs/internals/contributing/writing-code/submitting-patches.txt b/docs/internals/contributing/writing-code/submitting-patches.txt index f0a41ea954f7..288a50fc76b4 100644 --- a/docs/internals/contributing/writing-code/submitting-patches.txt +++ b/docs/internals/contributing/writing-code/submitting-patches.txt @@ -18,6 +18,8 @@ requests without a Trac ticket. See the :doc:`/internals/contributing/writing-code/working-with-git` for more details on how to use pull requests. +.. _claiming-tickets: + "Claiming" tickets ================== @@ -40,13 +42,14 @@ and time availability), claim it by following these steps: `ticket tracker`_. Remember that proposals for new features should follow the :ref:`process for suggesting new features `. -* If a ticket for this issue already exists, make sure nobody else has - claimed it. To do this, look at the "Owned by" section of the ticket. - If it's assigned to "nobody," then it's available to be claimed. +* If a ticket for this issue already exists and has been accepted, make sure + nobody else has claimed it. To do this, look at the "Owned by" section of + the ticket. If it's assigned to "nobody," then it's available to be claimed. Otherwise, somebody else may be working on this ticket. Either find another bug/feature to work on, or contact the developer working on the ticket to offer your help. If a ticket has been assigned for weeks or months without - any activity, it's probably safe to reassign it to yourself. + any activity, it's probably safe to reassign it to yourself. If a ticket + hasn't been approved yet, join the conversation. * Log into your account, if you haven't already, by clicking "GitHub Login" or "DjangoProject Login" in the upper left of the ticket page. Once logged diff --git a/docs/spelling_wordlist b/docs/spelling_wordlist index fdd12a3f1f69..1aa456b91af1 100644 --- a/docs/spelling_wordlist +++ b/docs/spelling_wordlist @@ -561,7 +561,7 @@ unpythonic Unregisters unrendered unreproducible -Unreviewed +unreviewed unsanitized unselected unsets