Re: runtime error on SPGIST, needed help

From: "Simone Campora" <simone(dot)campora(at)gmail(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: runtime error on SPGIST, needed help
Date: 2008-04-17 14:33:31
Message-ID: 177b806f0804170733i680d4d77l80d1e4883c006e88@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello and really thanks for the answer, I found the solution for the problem
also thanks to the gdb debugger. My problem was a SegmentationFault runtime
error due to a little tricky:

the function SPGIST_FUNCTION(pquad_equals_op) is defined as follows

#define SPGIST_FUNCTION(name) extern "C" Datum name(PG_FUNCTION_ARGS)

extern "C" {
PG_FUNCTION_INFO_V1(pquad_consistent);
PG_FUNCTION_INFO_V1(pquad_nn_consistent);
PG_FUNCTION_INFO_V1(pquad_penalty);
PG_FUNCTION_INFO_V1(pquad_checkinternalsplit);
PG_FUNCTION_INFO_V1(pquad_picksplit);
PG_FUNCTION_INFO_V1(pquad_childbp);
PG_FUNCTION_INFO_V1(pquad_keylen);
PG_FUNCTION_INFO_V1(pquad_check);
PG_FUNCTION_INFO_V1(pquad_printpred);
PG_FUNCTION_INFO_V1(pquad_getpred);
PG_FUNCTION_INFO_V1(pquad_getparam);
PG_FUNCTION_INFO_V1(pquad_inside_op);
PG_FUNCTION_INFO_V1(pquad_check_chaining);
}

but as you can see, this "C" lacks the row

PG_FUNCTION_INFO_V1(pquad_equals_op);

that's why it was not working... I didn't noticed it because as far as I
don't access any pointer's argument, I don't get any error back! (I really
don't know why, is it maybe because of some default setting?)

Anyway thanks again to all!

Simone

On 12/04/2008, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> "Simone Campora" <simone(dot)campora(at)gmail(dot)com> writes:
> > I first want to implement it and to make it works, like this:
>
> > SPGIST_FUNCTION(pquad_equals_op)
> > {
> > elog (NOTICE, "1");
>
> > Point *p1 = (Point *)PG_GETARG_POINTER(0);
> > Point *p2 = (Point *)PG_GETARG_POINTER(1);
>
> > elog (NOTICE, "2");
>
>
> (1) are you sure this function is marked as being V1 calling convention?
> Maybe "SPGIST_FUNCTION" takes care of that for you but I don't know.
>
> (2) since you neither marked it STRICT nor defended against nulls in the
> function body, I'd fully expect a crash on a null input ... does that
> table contain any null points?
>
>
> > Could anyone suggest me a good runtime debugger for that purpose?
>
>
> Any C debugger should work fine. gdb and ddd are the most common
> tools around this project, I think.
>
> regards, tom lane
>

--
Campora Simone,
________________________
School of computer science
Swiss Federal Institute of Technology, Lausanne
EPFL

E-MAIL: simone(dot)campora(at)gmail(dot)com
simone(dot)campora(at)epfl(dot)ch

WWW: www.simonecampora.com

MOBILE: +41 762 563466
+39 347 8036605

SKYPE: sim0ne.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2008-04-17 14:36:59 Re: get rid of psql welcome message
Previous Message Alvaro Herrera 2008-04-17 14:26:34 Re: Lessons from commit fest