[postgis-users] PLPGSQL, parametrizing a column name and a GEOMETRY

Charles Galpin cgalpin at lhsw.com
Fri Dec 3 06:00:35 PST 2010


Sebastian, you might want to try something like

EXECUTE 'UPDATE ' || quote_ident(table_name) || ' SET FIELD=' || CAST(''' || CAST(geometry as text) || ''' as geometry)

hth
charles

On Dec 3, 2010, at 6:59 AM, Sebastian E. Ovide wrote:

> Hi All,
> 
> I'm creating a PLPGSQL which has 2 parameters: a geometry and a table name.
> 
> The query is something like UPDATE table_name SET FIELD=geometry.
> 
> I've tried to use EXECUTE like this
> 
> EXECUTE 'UPDATE '||quote_ident(table_name)||' SET FIELD='||geometry::geometry
> 
> but I'm getting an error in the geometry: (HINT:  Could not choose a best candidate operator. You might need to add explicit type casts.)
> 
> any ideas ?
> 
> -- 
> Sebastian E. Ovide
> 
> 
> 
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list