#34860: Order_by is broken when sorting on an annotated postgres window function
value
-------------------------------------+-------------------------------------
Reporter: Bernhard Mäder | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 4.2
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Window Postgres | Triage Stage:
order_by | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by David Sanders):
Is there some context missing here? From the details you've given, it is
sorting by rank 🤔
{{{
sample=# table ticket_34860_window_order_by_a;
id | a
----+---
1 | a
2 | b
3 | c
4 | b
(4 rows)
sample=# SELECT "ticket_34860_window_order_by_a"."id",
"ticket_34860_window_order_by_a"."a",
count('id') OVER (PARTITION BY
"ticket_34860_window_order_by_a"."a") AS "rank"
FROM "ticket_34860_window_order_by_a"
ORDER BY 3 ASC ;
id | a | rank
----+---+------
1 | a | 1
3 | c | 1
2 | b | 2
4 | b | 2
(4 rows)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/34860#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/0107018ab7bfb62e-b0592587-3e5a-4cc7-a35b-5209cbe8e5f9-000000%40eu-central-1.amazonses.com.