Обсуждение: segmentation fault in function
I am realizing gist index and get a bug, that crashes DB. I' debugged my program as Robert(thanks !) advised me and I know which procedure crashed.
Datum gist_mov_consistent(PG_FUNCTION_ARGS)
{
GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
BOX *query = PG_GETARG_BOX_P(1);
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
if (DatumGetMovP(entry->key) == NULL || query == NULL)
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(obj_contains(DatumGetMovP(entry->key), query));
}
int obj_contains(moving_object *a, BOX *b)
{
if (b->low.x > a->x_low)
return 0;
if (b->low.y > a->y_low)
return 0;
if (b->high.x < a->x_high)
return 0;
if (b->high.y < a->y_high)
return 0;
return 1;
}
Do you have any ideas ?
Best regards,
Sergej Galkin
{
GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
BOX *query = PG_GETARG_BOX_P(1);
StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
if (DatumGetMovP(entry->key) == NULL || query == NULL)
PG_RETURN_BOOL(FALSE);
PG_RETURN_BOOL(obj_contains(DatumGetMovP(entry->key), query));
}
int obj_contains(moving_object *a, BOX *b)
{
if (b->low.x > a->x_low)
return 0;
if (b->low.y > a->y_low)
return 0;
if (b->high.x < a->x_high)
return 0;
if (b->high.y < a->y_high)
return 0;
return 1;
}
Do you have any ideas ?
Best regards,
Sergej Galkin
Sergej Galkin <sergej.galkin@gmail.com> writes: > I am realizing gist index and get a bug, that crashes DB. I' debugged > my program as Robert(thanks !) advised me and I know which procedure > crashed. Using gdb you should have the line number in the source code and should be able to look up the variable values. For that you need to use a custom PostgreSQL build using --with-cassert --enable-debug. Then report some more details if you still need help. Also have a look at Gevel to be able to inspect your index : http://www.sai.msu.su/~megera/wiki/Gevel Regards, -- dim