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

Sebastian E. Ovide sebastian.ovide at gmail.com
Fri Dec 3 06:51:52 PST 2010


Thanks Charles,

The USING did the trick

EXECUTE 'UPDATE ' || quote_ident(table_name) || ' SET FIELD= $1' USING
geometry

On Fri, Dec 3, 2010 at 2:00 PM, Charles Galpin <cgalpin at lhsw.com> wrote:

> 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
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>



-- 
Sebastian E. Ovide
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101203/f04bba24/attachment.html>


More information about the postgis-users mailing list