<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16735" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=503555810-27102008>Chetan,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
class=503555810-27102008>I think its this part that may be giving you problems 
-- </SPAN></FONT></DIV>
<DIV> </DIV>
<DIV>''' || temp_geom || ''' </DIV>
<DIV> </DIV>
<DIV><SPAN class=503555810-27102008></SPAN><FONT face=Arial><FONT 
color=#0000ff><FONT size=2>I<SPAN class=503555810-27102008>'m assuming temp_geom 
is a geometry and 8.3 has taken out a lot of default casting 
behavior.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008>In general I try to avoid having the database do these 
automatic castings except when its common because its too unpredicatable from 
database platform to platform or even version to version of same db 
product.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008>Try changing that to</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT><FONT><SPAN class=503555810-27102008>''' || CAST(temp_geom As 
text) || ''' </SPAN></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008>Unfortunately I don't have a 8.3 lying around at the 
moment to test.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008>Also it appears from the small snippet you provided 
that you are using old syntax instead of $ quoting, named variables - so its 
harder to follow what you are doing.</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008>Hope that helps,</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008>Regina</SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial><FONT color=#0000ff><FONT size=2><SPAN 
class=503555810-27102008></SPAN></FONT></FONT></FONT> </DIV>
<DIV><BR></DIV>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> 
postgis-users-bounces@postgis.refractions.net 
[mailto:postgis-users-bounces@postgis.refractions.net] <B>On Behalf Of 
</B>Chetan Tiwari<BR><B>Sent:</B> Monday, October 27, 2008 2:11 AM<BR><B>To:</B> 
PostGIS Users Discussion<BR><B>Subject:</B> [postgis-users] operator is not 
unique error<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV>Hi All</DIV>
<DIV> </DIV>
<DIV>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:</DIV>
<DIV> </DIV>
<DIV>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;</DIV>
<DIV> </DIV>
<DIV>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:</DIV>
<DIV> </DIV>
<DIV>
<P>ERROR:  operator is not unique: text || geometry<BR>LINE 1: ...ast 
(st_extent(the_geom) as geometry) && cast(''' ||  $3  
||...<BR>                                                             
^<BR>HINT:  Could not choose a best candidate operator. You might need to 
add explicit type casts.<BR>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'<BR>CONTEXT:  PL/pgSQL function 
"computegrid_quad" line 84 at EXECUTE statement</P>
<P><BR>********** Error **********</P>
<P>ERROR: operator is not unique: text || geometry<BR>SQL state: 42725<BR>Hint: 
Could not choose a best candidate operator. You might need to add explicit type 
casts.<BR>Context: PL/pgSQL function "computegrid_quad" line 84 at EXECUTE 
statement</P>
<P>I did find some information about this online, but can't quite get a hold on 
the problem. Any suggestions will be most appreciated.</P>
<P>Thanks much,</P>
<P>Chetan</P></DIV></BODY></HTML>

<HTML><BODY><P><hr size=1></P>
<P><STRONG>
The substance of this message, including any attachments, may be confidential, legally privileged and/or exempt from disclosure pursuant to Massachusetts law. It is intended solely for the addressee. If you received this in error, please contact the sender and delete the material from any computer.
</STRONG></P></BODY></HTML>

<P><hr size=1></P>
<P><STRONG><font size="2" color="339900"> Help make the earth a greener place. If at all possible resist printing this email and join us in saving paper. </p> <p> </font></STRONG></P>