[postgis-users] Problem With Geometries and a View

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Tue Jan 30 07:19:42 PST 2007


On Tue, 2007-01-30 at 10:47 -0300, Leonardo Mateo wrote:

(cut)

>  - Then I try to select the extent of these points with:
>  [CODE]
>    select extent('the_geom') from geom;
>  [/CODE]
>   And I got this error:
>   ERROR:  parse error - invalid geometry
> 
> The weird thing is that if I insert that SELECT sentence into another
> table and create a view from that table with something like this:
>   [CODE]
>     create view geom as Select * from <newtable>
>   [/CODE]
> 
> The extent is selected properly.
> 
> What am I doing wrong? It's driving me nuts.
> 
> Thanx a lot in advance.


Hi Leonardo,

The extent() function is an aggregate, and so requires a column
reference as opposed to a string. So your select should not have
apostrophes around the argument to the extent() function and should look
like this:

	select extent(the_geom) from geom;

(FWIW I don't see a column called "the_geom" in your view; you may need
to use AS to create an alias for your GeomFromText() calculation).


Kind regards,

Mark.





More information about the postgis-users mailing list