[postgis-users] operator is not unique error

Chetan Tiwari chetan.tiwari at gmail.com
Sun Oct 26 23:11:25 PDT 2008


Hi All

I've been having a bit of trouble after recently upgrading to postgresql
8.3. I have a small function that used to work fine before the upgrade. The
code is in pgsql, and the specific line that is giving me problems is as
follows:

execute 'select sum(weight) from ' || quote_ident($1) || '.' ||
quote_ident($2) || ' where the_geom && ''' || temp_geom || ''' order by sum
desc limit 1' into pts_weight;

I am trying calculate a weighted sum of all points (defined by 'the_geom')
that fall within the bounding box of a polygon defined by 'temp_geom'. The
error I get is as follows:


ERROR:  operator is not unique: text || geometry
LINE 1: ...ast (st_extent(the_geom) as geometry) && cast(''' ||  $3  ||...
                                                             ^
HINT:  Could not choose a best candidate operator. You might need to add
explicit type casts.
QUERY:  SELECT  'select sum(weight) from ' || quote_ident( $1 ) || '.' ||
quote_ident( $2 ) || ' where cast (st_extent(the_geom) as geometry) &&
cast(''' ||  $3  || ''' as geometry) order by sum desc limit 1'
CONTEXT:  PL/pgSQL function "computegrid_quad" line 84 at EXECUTE statement


********** Error **********

ERROR: operator is not unique: text || geometry
SQL state: 42725
Hint: Could not choose a best candidate operator. You might need to add
explicit type casts.
Context: PL/pgSQL function "computegrid_quad" line 84 at EXECUTE statement

I did find some information about this online, but can't quite get a hold on
the problem. Any suggestions will be most appreciated.

Thanks much,

Chetan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081027/f78ac469/attachment.html>


More information about the postgis-users mailing list