Changes between Initial Version and Version 1 of Ticket #15101
- Timestamp:
- Jan 17, 2011, 12:41:36 PM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #15101 – Description
initial v1 1 1 I have an object with geometry points. 2 2 3 I expected to be able to return 100 objects' extent using a limit. However as demonstrated below the limit is never in the raw sql query. 3 I expected to be able to return 100 objects' extent using a limit. However as demonstrated below the limit is never in the raw sql query: 4 {{{ 5 #!python 6 >>> test = SamAddress.objects.all()[:100].extent() 7 >>> print test; 8 (-84.390510000000006, 33.754629999999999, -77.678370000000001, 40.513269999999999) 4 9 5 test = SamAddress.objects.all()[:100].extent() 6 7 print test; 8 9 (-84.390510000000006, 33.754629999999999, -77.678370000000001, 40.513269999999999) 10 11 test = SamAddress.objects.all().extent() 12 13 print test; 14 15 (-84.390510000000006, 33.754629999999999, -77.678370000000001, 40.513269999999999) 10 >>> test = SamAddress.objects.all().extent() 11 >>> print test; 12 (-84.390510000000006, 33.754629999999999, -77.678370000000001, 40.513269999999999) 13 }}} 16 14 17 15 Debug from postgres..... 18 16 {{{ 19 17 2011-01-16 18:45:04 EST LOG: statement: SELECT ST_Extent("world_samaddress"."geometry") AS "geoagg" FROM "world_samaddress" 20 18 21 19 2011-01-16 18:45:13 EST LOG: statement: SELECT ST_Extent("world_samaddress"."geometry") AS "geoagg" FROM "world_samaddress" 20 }}} 22 21 23 This actually makes sense since ST_Extent is indeed an aggregate function and cannot be limited (similar to count() or sum()).22 This actually makes sense since `ST_Extent` is indeed an aggregate function and cannot be limited (similar to `count()` or `sum()`). 24 23 25 I am running geodjango 1.2.3. 24 I am running geodjango 1.2.3. 25 26 26 Version 1.3 alpha 1 SVN-14993 is different in that it does pass through the limits looking like this... 27 27 28 28 Debug from postgres 29 29 {{{ 30 30 2011-01-16 17:39:10 EST LOG: statement: SELECT ST_Extent("world_samaddress"."geometry") AS "geoagg" FROM "world_samaddress limit 100" 31 }}} 31 32 32 33 I don't know why my version does not use the limits on extent() and or count(). 33 34 However the return value would still be the aggregate and not the limited results. 35 {{{ 36 select ST_Extent(geometry) from world_samaddress limit 1; 34 37 35 select ST_Extent(geometry) from world_samaddress limit 1; 38 BOX(-84.39051 33.75463,-77.67837 40.51327) 36 39 37 BOX(-84.39051 33.75463,-77.67837 40.51327) 40 select ST_Extent(geometry) from world_samaddress; 38 41 39 select ST_Extent(geometry) from world_samaddress; 40 41 BOX(-84.39051 33.75463,-77.67837 40.51327) 42 42 BOX(-84.39051 33.75463,-77.67837 40.51327) 43 }}} 43 44 The same would go for count() (or any aggregate function? 44 45 45 46 In future versions if a subselect were used it would do what I wanted it to do (which is odd) but return the extent of 100 points. 46 47 {{{ 47 48 select ST_Extent(geometry) from (select geometry from world_samaddress limit 1) as foo; 48 49 … … 52 53 53 54 BOX(-84.39051 33.75463,-77.67837 40.51327) 55 }}}