Opened 3 weeks ago

Last modified 3 weeks ago

#37420 assigned New feature

GIS ST_MakeLine, ST_Union and ST_Collect should accept the ORDER BY clause

Reported by: Jefferson Raylan Owned by: Jefferson Raylan
Component: GIS Version: 6.1
Severity: Normal Keywords:
Cc: Jefferson Raylan, Vaibhav Pant Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since PostGIS version 2.2, ST_MakeLine, ST_Union, and ST_Collect accept the ORDER BY clause when running on PostgreSQL version 9+. However, Django still does not support it. It would be nice to have this feature integrated. Since Django currently requires PostgreSQL version 15+ and PostGIS version 3.2, backward compatibility so it should not be an issue

Postgres 9.0.0 release note:
​https://www.postgresql.org/docs/release/9.0.0/#AEN103013

PostGIS 2.2 ST_MakeLine manual:
​https://postgis.net/docs/manual-2.2/ST_MakeLine.html#idm4835

Django 6.1 release note about PostgreSQL version:
​https://docs.djangoproject.com/en/6.1/releases/6.1/#dropped-support-for-postgresql-14

Django 6.1 release note about PostGIS version:
​https://docs.djangoproject.com/en/6.1/releases/6.1/#id3

Change History (7)

comment:1 by Jacob Walls, 3 weeks ago

Triage Stage: Unreviewed → Accepted
Type: Uncategorized → New feature

Thanks, it should be relatively simple: setting allow_order_by = True on the MakeLine class, etc., and checking cross-database support.

Do you know if Extent and Extent3D also support ordering?

Finally, would you like to submit a PR?

comment:2 by Vaibhav Pant, 3 weeks ago

Cc: Vaibhav Pant added

Hi Jefferson, are you planning to work on this? If not, I’d be happy to take it.

in reply to:  1 comment:3 by Jefferson Raylan, 3 weeks ago

Replying to Jacob Walls:

Thanks, it should be relatively simple: setting allow_order_by = True on the MakeLine class, etc., and checking cross-database support.

Do you know if Extent and Extent3D also support ordering?

Finally, would you like to submit a PR?

It's not that simple. Other backend may not support ORDER BY on those aggregate, so I followed the same principle used in disallowed_aggregates. I'll be happy to submit a pull request.

comment:4 by Jacob Walls, 3 weeks ago

Owner: set to Jefferson Raylan
Status: new → assigned

in reply to:  2 comment:5 by Jefferson Raylan, 3 weeks ago

Replying to Vaibhav Pant:

Hi Jefferson, are you planning to work on this? If not, I’d be happy to take it.

Hi, I'm already worked on this. But any feedback and contribution are more than welcome.

Version 0, edited 3 weeks ago by Jefferson Raylan (next)

in reply to:  1 comment:7 by Jefferson Raylan, 3 weeks ago

Replying to Jacob Walls:

Do you know if Extent and Extent3D also support ordering?

The result of Extent and Extent3D aggregations shouldn't change based on the order of the entries, since they look for the min and max values, so I don't think it's really necessary.

Note: See TracTickets for help on using tickets.
Back to Top