Changes between Initial Version and Version 1 of Ticket #15101


Ignore:
Timestamp:
Jan 17, 2011, 12:41:36 PM (14 years ago)
Author:
jbronn
Comment:

Cleaned up ticket formatting.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15101 – Description

    initial v1  
    11I have an object with geometry points.
    22
    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.
     3I 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)
    49
    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}}}
    1614
    1715Debug from postgres.....
    18 
     16{{{
    19172011-01-16 18:45:04 EST LOG:  statement: SELECT ST_Extent("world_samaddress"."geometry") AS "geoagg" FROM "world_samaddress"
    2018
    21192011-01-16 18:45:13 EST LOG:  statement: SELECT ST_Extent("world_samaddress"."geometry") AS "geoagg" FROM "world_samaddress"
     20}}}
    2221
    23 This actually makes sense since ST_Extent is indeed an aggregate function and cannot be limited (similar to count() or sum()).
     22This actually makes sense since `ST_Extent` is indeed an aggregate function and cannot be limited (similar to `count()` or `sum()`).
    2423
    25 I am running geodjango 1.2.3.
     24I am running geodjango 1.2.3.
     25
    2626Version 1.3 alpha 1 SVN-14993 is different in that it does pass through the limits looking like this...
    2727
    2828Debug from postgres
    29 
     29{{{
    30302011-01-16 17:39:10 EST LOG:  statement: SELECT ST_Extent("world_samaddress"."geometry") AS "geoagg" FROM "world_samaddress limit 100"
     31}}}
    3132
    3233I don't know why my version does not use the limits on extent() and or count().
    3334However the return value would still be the aggregate and not the limited results.
     35{{{
     36select ST_Extent(geometry) from world_samaddress limit 1;
    3437
    35  select ST_Extent(geometry) from world_samaddress limit 1;
     38BOX(-84.39051 33.75463,-77.67837 40.51327)
    3639
    37  BOX(-84.39051 33.75463,-77.67837 40.51327)
     40select ST_Extent(geometry) from world_samaddress;
    3841
    39  select ST_Extent(geometry) from world_samaddress;
    40 
    41  BOX(-84.39051 33.75463,-77.67837 40.51327)
    42 
     42BOX(-84.39051 33.75463,-77.67837 40.51327)
     43}}}
    4344The same would go for count() (or any aggregate function?
    4445
    4546In 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{{{
    4748 select ST_Extent(geometry) from (select geometry from world_samaddress limit 1) as foo;
    4849
     
    5253 
    5354 BOX(-84.39051 33.75463,-77.67837 40.51327)
     55}}}
Back to Top