runtime error on SPGIST, needed help - Mailing list pgsql-hackers

From Simone Campora
Subject runtime error on SPGIST, needed help
Date
Msg-id 177b806f0804120818j72fadc8co914572bb4ba5084e@mail.gmail.com
Whole thread Raw
Responses Re: runtime error on SPGIST, needed help  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
<br clear="all" />Hello to all of you! I'm new of this newsletter but I hope that this is the good place to send this
helprequest!<br />I'm a student and I'm developing a quadtree index using postgresql 8.0.15 under Linux Ubuntu  7.10
GustyGibbon, but I have the following problem:<br /><br />I downloaded the GIST extension SPGIST from the website <a
href="http://www.cs.purdue.edu/spgist/">http://www.cs.purdue.edu/spgist/</a><br/><br />and I tried to modify some C
functionsused by the operators (for instance the == used between Point and Point)<br /><br /><span
class="gmail_quote"><spanclass="gmail_sendername">here there is a function in the ./spgist-pquad/spgist_pquad.cc that
is:<br/><br /><span style="font-style: italic;">SPGIST_FUNCTION(pquad_equals_op)  </span><br style="font-style:
italic;"/><span style="font-style: italic;">{</span><br style="font-style: italic;" /><span style="font-style:
italic;">       PG_RETURN_BOOL(true);</span><br style="font-style: italic;" /><span style="font-style:
italic;">}</span><br/><br />That is the one that is used by the operator == defined as follows:<br /><br />CREATE OR
REPLACEFUNCTION pquad_equals_op(point,point) RETURNS bool AS '/usr/local/lib/libspgist_pquad' LANGUAGE 'C';<br />CREATE
OPERATOR== ( LEFTARG = point, RIGHTARG = point, PROCEDURE = pquad_equals_op, RESTRICT = eqsel, JOIN = eqjoinsel);<br
/><br/>I first want to implement it and to make it works, like this:<br /><br style="font-style: italic;" /><span
style="font-style:italic;">SPGIST_FUNCTION(pquad_equals_op)  </span><br style="font-style: italic;" /><span
style="font-style:italic;">{</span><br style="font-style: italic;" /><span style="font-style: italic;">    elog
(NOTICE,"1");</span><br style="font-style: italic;" /><br style="font-style: italic;" /><span style="font-style:
italic;">   Point *p1 = (Point *)PG_GETARG_POINTER(0);</span><br style="font-style: italic;" /><span style="font-style:
italic;">   Point *p2 = (Point *)PG_GETARG_POINTER(1);<br /><br style="font-style: italic;" /></span><span
style="font-style:italic;">    elog (NOTICE, "2");<br /><br style="font-style: italic;" /></span><span
style="font-style:italic;">    if((p1->x == p2->x) && (p1->y == p2->y))</span><br
style="font-style:italic;" /><span style="font-style: italic;">    {</span><br style="font-style: italic;" /><span
style="font-style:italic;">        PG_RETURN_BOOL(true);</span><br style="font-style: italic;" /><span
style="font-style:italic;">    }</span><br style="font-style: italic;" /><span style="font-style: italic;">   
else</span><brstyle="font-style: italic;" /><span style="font-style: italic;">    {</span><br style="font-style:
italic;"/><span style="font-style: italic;">        PG_RETURN_BOOL(false);</span><br style="font-style: italic;"
/><spanstyle="font-style: italic;">    }</span><br style="font-style: italic;" /><span style="font-style:
italic;"> </span><brstyle="font-style: italic;" /><span style="font-style: italic;">}</span><br /><br />I can compile
itwithout problem but when I use that operator in a sql query like:<br /><br style="font-style: italic;"
/></span></span><spanclass="gmail_quote" style="font-style: italic;"><span class="gmail_sendername">select * from
tablepoints p1 where p1.point == '(1,1)';</span></span><br /><span class="gmail_quote"><span
class="gmail_sendername"><br/> then the process simply crash by signal 11 and without any useful feedback on the
motivation(it just prints out the notice "1" and "2").<br />Is that an already known problem? Honestly I found it very
hardto discover the problem and I still don't have a solution.</span></span><br /><br /><br />Could anyone suggest me a
goodruntime debugger for that purpose?<br /><br />Thanks to all of you!!<br /><br />Simone<br /><br /><br /><br />--
<br/>Campora Simone,<br />________________________<br />School of computer science<br />Swiss Federal Institute of
Technology,Lausanne<br /> EPFL<br /><br />E-MAIL: <a
href="mailto:simone.campora@gmail.com">simone.campora@gmail.com</a><br/>             simone.campora@epfl.ch<br /><br
/>WWW:<a href="http://www.simonecampora.com">www.simonecampora.com</a><br /><br />MOBILE:  +41 762 563466<br />
              +39 347 8036605<br /><br />SKYPE: sim0ne.  

pgsql-hackers by date:

Previous
From: Perez
Date:
Subject: Re: Cached Query Plans (was: global prepared statements)
Next
From: Tom Lane
Date:
Subject: Re: runtime error on SPGIST, needed help