Re: [Django] #36152: Annotation with `%` in alias fails at db level on Postgres and MySQL

13 views
Skip to first unread message

Django

unread,
Jan 28, 2025, 2:12:51 PMJan 28
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: | Status: new
Cleanup/optimization |
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted

Comment:

I'm inclined to go with the "make `FORBIDDEN_ALIAS_PATTERN` more
restrictive" option, accepting the ticket on that basis.
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 17, 2025, 10:43:56 PMFeb 17
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* has_patch: 0 => 1
* owner: (none) => Jacob Walls
* status: new => assigned

Comment:

[https://github.com/django/django/pull/19187 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:6>

Django

unread,
Feb 24, 2025, 4:51:18 PMFeb 24
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* cc: Mariusz Felisiak (added)

Comment:

Is not this a duplicate of #6343?
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:7>

Django

unread,
Feb 25, 2025, 8:06:39 AMFeb 25
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls):

I see merit in handling the two issues separately.

#6343 refers to table and column names, which are rarely if ever driven by
user input and potentially outside the developer's control for legacy
databases (see the end of comment:4). This is a harder problem.

With this ticket's focus on aliases, which could be controlled by a user
(or a user of a reusable app, e.g. supplying dynamic annotations), I'm
seeing a consensus for deprecating the buggy behavior and a reasonable
upgrade path, since there are no database entities to adjust.
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:8>

Django

unread,
Jun 18, 2025, 10:27:25 AMJun 18
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: assigned
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):

* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:9>

Django

unread,
Jun 20, 2025, 2:25:32 AMJun 20
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce <42296566+sarahboyce@…>):

* resolution: => fixed
* status: assigned => closed

Comment:

In [changeset:"8ede411a81b40ca53362e6788601193c7e56a0cf" 8ede411]:
{{{#!CommitTicketReference repository=""
revision="8ede411a81b40ca53362e6788601193c7e56a0cf"
Fixed #36152 -- Deprecated use of "%" in column aliases.

Unintentional support existed only on SQLite and Oracle.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:10>

Django

unread,
Aug 29, 2025, 1:45:19 PMAug 29
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"2d453a2a683d73c64dc32286685eb40cbca7c425" 2d453a2a]:
{{{#!CommitTicketReference repository=""
revision="2d453a2a683d73c64dc32286685eb40cbca7c425"
Refs #36152 -- Suppressed duplicate warning when using "%" in alias via
values().
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:11>

Django

unread,
Sep 19, 2025, 2:38:18 PM (3 days ago) Sep 19
to django-...@googlegroups.com
#36152: Annotation with `%` in alias fails at db level on Postgres and MySQL
-------------------------------------+-------------------------------------
Reporter: Jacob Walls | Owner: Jacob
Type: | Walls
Cleanup/optimization | Status: closed
Component: Database layer | Version: 5.1
(models, ORM) |
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Jacob Walls <jacobtylerwalls@…>):

In [changeset:"fd705912fff168d10c806568a222dfa25e3bb6a0" fd705912]:
{{{#!CommitTicketReference repository=""
revision="fd705912fff168d10c806568a222dfa25e3bb6a0"
Refs #36152, #35667 -- Used skip_file_prefixes in alias deprecation
warning.

Follow-up to 8ede411a81b40ca53362e6788601193c7e56a0cf.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/36152#comment:12>
Reply all
Reply to author
Forward
0 new messages