[postgis-users] Strange SQL error

Stephen Woodbridge woodbri at swoodbridge.com
Tue Nov 8 20:09:46 PST 2005


Stephen Davies wrote:
> G'day.
> 
> If I submit the following to psql I get an error saying that miny must 
> be included in an aggregate function.
> 
> select extent(mbr),minx,miny,maxx,maxy from logger left join refmap on 
> logger.refmap=refmap.name where logger.id=1
> 
> If I change the function to astext(mbr), there is no error and the 
> result is usable.
> 
> Is there a way to make the first version work?

There is nothing strange about this. extent() is an aggregate function 
that returns a BBOX of all the objects passed into it. As such it 
behaves the same as the sum() function.

Since you only are passing one object to it and you want the bbox of it 
you should replace extent(mbr) with box2d(mbr) or box3d(mbr).

-Steve W.



More information about the postgis-users mailing list