[postgis-users] Parse error - Invalid geometry in function

Michael Fuhr mike at fuhr.org
Fri Aug 4 07:05:32 PDT 2006


On Fri, Aug 04, 2006 at 07:48:59AM -0400, Sylvain Racine wrote:
> I wrote a function who looks up in an address table and records it if 
> not. I have a problem with INSERT INTO statement. When I do it alone, it 
> works fine. But if I use it inside a function (using variables) while I 
> want to enter a new address, I got a 'parse error - invalid geometry'. 
[...]
> 		INSERT INTO adresses(adresse,geom)
> 		  VALUES (_adresse, GeometryFromText(\'POINT(_lon 
> 		  _lat)\',4269));

You're using the literal string 'POINT(_lon _lat)' instead of
interpolating the values of _lon and _lat.  You could build the
string with concatenation (the || operator), or you could pass in
_lon and _lat as double precision (or cast their varchar values to
double precision) and use MakePoint() and SetSRID().

-- 
Michael Fuhr



More information about the postgis-users mailing list