Hi Regina<br><br>Thanks much! That fixed it! Yes, you are correct, this is an old piece of code that generates a weighted quad-tree from a set of points. I spent some time on this last night, except I was casting temp_geom to geometry instead of text! Anyway, this is a big relief - thanks again!<br>
<br>Regards,<br><br>Chetan<br><br><div class="gmail_quote">On Mon, Oct 27, 2008 at 6:07 AM, Obe, Regina <span dir="ltr"><<a href="mailto:robe.dnd@cityofboston.gov">robe.dnd@cityofboston.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><font size="2" color="#0000ff" face="Arial"><span>Chetan,</span></font></div>
<div dir="ltr" align="left"><font size="2" color="#0000ff" face="Arial"><span>I think its this part that may be giving you problems
-- </span></font></div>
<div> </div>
<div>''' || temp_geom || ''' </div>
<div> </div>
<div><span></span><font face="Arial"><font color="#0000ff"><font size="2">I<span>'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></span></font></font></font> </div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span>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></span></font></font></font> </div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span>Try changing that to</span></font></font></font></div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font> </div>
<div><font><font><span>''' || CAST(temp_geom As
text) || ''' </span></font></font></div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font> </div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span>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></span></font></font></font> </div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span>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></span></font></font></font> </div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span>Hope that helps,</span></font></font></font></div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span>Regina</span></font></font></font></div>
<div><font face="Arial"><font color="#0000ff"><font size="2"><span></span></font></font></font> </div>
<div><br></div>
<div dir="ltr" align="left" lang="en-us">
<hr>
<font size="2" face="Tahoma"><b>From:</b>
<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a>
[mailto:<a href="mailto:postgis-users-bounces@postgis.refractions.net" target="_blank">postgis-users-bounces@postgis.refractions.net</a>] <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><div class="Wj3C7c">
<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></div></div></div>
<div><p></p><hr size="1">
<p><b>
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.
</b></p></div>
<p></p><hr size="1">
<p><b><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. </font></b></p> <p> </p><br>_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br>
<a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Chetan Tiwari, PhD<br>Assistant Professor<br>University of North Texas<br>Department of Geography<br>1155 Union Circle #305279<br>Denton, TX 76203-5017<br>