[postgis-users] Update field from expression

Charles Galpin cgalpin at lhsw.com
Thu Jan 27 16:42:24 PST 2011


David, I believe the (…) as giddy is what is returning the rec. If so you just need to change it to  SET huc = giddy.huc

hth
charles

On Jan 27, 2011, at 5:37 PM, Poynter, David wrote:

> Greetings PostGIS list,
> 
> I am trying to populate a relate field (huc) in a point table
> (permit_sites) from the gid field in a multi-polygon table (huc8).
> 
> This is what I came up with:
> 
> UPDATE permit_sites SET huc = giddy FROM (SELECT h.gid FROM huc8 h,
> permit_sites p WHERE ST_Within(p.the_geom,h.the_geom)) AS giddy;
> 
> Whence I get this response:
> 
> ERROR:  column "huc" is of type integer but expression is of type record
> HINT:  You will need to rewrite or cast the expression.
> 
> Seems I can't take the hint, I tried casting but it is apparently
> impossible to cast a record as an integer, at least for me.
> 
> Any suggestions as to how I should proceed would be appreciated.
> 
> david




More information about the postgis-users mailing list