*** pgsql/src/backend/access/gist/gistproc.c 2010/01/14 16:31:09 1.20 --- pgsql/src/backend/access/gist/gistproc.c 2010/02/26 02:00:33 1.21 *************** *** 10,16 **** * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.19 2010/01/02 16:57:34 momjian Exp $ * *------------------------------------------------------------------------- */ --- 10,16 ---- * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/access/gist/gistproc.c,v 1.20 2010/01/14 16:31:09 teodor Exp $ * *------------------------------------------------------------------------- */ *************** gist_point_compress(PG_FUNCTION_ARGS) *** 889,896 **** if (entry->leafkey) /* Point, actually */ { ! BOX *box = palloc(sizeof(BOX)); ! Point *point = DatumGetPointP(entry->key); GISTENTRY *retval = palloc(sizeof(GISTENTRY)); box->high = box->low = *point; --- 889,896 ---- if (entry->leafkey) /* Point, actually */ { ! BOX *box = palloc(sizeof(BOX)); ! Point *point = DatumGetPointP(entry->key); GISTENTRY *retval = palloc(sizeof(GISTENTRY)); box->high = box->low = *point; *************** gist_point_compress(PG_FUNCTION_ARGS) *** 906,914 **** static bool gist_point_consistent_internal(StrategyNumber strategy, ! bool isLeaf, BOX *key, Point *query) { ! bool result = false; switch (strategy) { --- 906,914 ---- static bool gist_point_consistent_internal(StrategyNumber strategy, ! bool isLeaf, BOX *key, Point *query) { ! bool result = false; switch (strategy) { *************** Datum *** 953,962 **** gist_point_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); ! StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); bool result; bool *recheck = (bool *) PG_GETARG_POINTER(4); ! StrategyNumber strategyGroup = strategy / GeoStrategyNumberOffset; switch (strategyGroup) { --- 953,962 ---- gist_point_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); ! StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); bool result; bool *recheck = (bool *) PG_GETARG_POINTER(4); ! StrategyNumber strategyGroup = strategy / GeoStrategyNumberOffset; switch (strategyGroup) { *************** gist_point_consistent(PG_FUNCTION_ARGS) *** 969,990 **** break; case BoxStrategyNumberGroup: result = DatumGetBool(DirectFunctionCall5( ! gist_box_consistent, ! PointerGetDatum(entry), ! PG_GETARG_DATUM(1), ! Int16GetDatum(RTOverlapStrategyNumber), ! 0, PointerGetDatum(recheck))); break; case PolygonStrategyNumberGroup: { POLYGON *query = PG_GETARG_POLYGON_P(1); result = DatumGetBool(DirectFunctionCall5( ! gist_poly_consistent, ! PointerGetDatum(entry), ! PolygonPGetDatum(query), ! Int16GetDatum(RTOverlapStrategyNumber), ! 0, PointerGetDatum(recheck))); if (GIST_LEAF(entry) && result) { --- 969,990 ---- break; case BoxStrategyNumberGroup: result = DatumGetBool(DirectFunctionCall5( ! gist_box_consistent, ! PointerGetDatum(entry), ! PG_GETARG_DATUM(1), ! Int16GetDatum(RTOverlapStrategyNumber), ! 0, PointerGetDatum(recheck))); break; case PolygonStrategyNumberGroup: { POLYGON *query = PG_GETARG_POLYGON_P(1); result = DatumGetBool(DirectFunctionCall5( ! gist_poly_consistent, ! PointerGetDatum(entry), ! PolygonPGetDatum(query), ! Int16GetDatum(RTOverlapStrategyNumber), ! 0, PointerGetDatum(recheck))); if (GIST_LEAF(entry) && result) { *************** gist_point_consistent(PG_FUNCTION_ARGS) *** 992,1004 **** * We are on leaf page and quick check shows overlapping * of polygon's bounding box and point */ ! BOX *box = DatumGetBoxP(entry->key); Assert(box->high.x == box->low.x ! && box->high.y == box->low.y); result = DatumGetBool(DirectFunctionCall2( ! poly_contain_pt, ! PolygonPGetDatum(query), PointPGetDatum(&box->high))); *recheck = false; } --- 992,1004 ---- * We are on leaf page and quick check shows overlapping * of polygon's bounding box and point */ ! BOX *box = DatumGetBoxP(entry->key); Assert(box->high.x == box->low.x ! && box->high.y == box->low.y); result = DatumGetBool(DirectFunctionCall2( ! poly_contain_pt, ! PolygonPGetDatum(query), PointPGetDatum(&box->high))); *recheck = false; } *************** gist_point_consistent(PG_FUNCTION_ARGS) *** 1006,1019 **** break; case CircleStrategyNumberGroup: { ! CIRCLE *query = PG_GETARG_CIRCLE_P(1); result = DatumGetBool(DirectFunctionCall5( ! gist_circle_consistent, ! PointerGetDatum(entry), ! CirclePGetDatum(query), ! Int16GetDatum(RTOverlapStrategyNumber), ! 0, PointerGetDatum(recheck))); if (GIST_LEAF(entry) && result) { --- 1006,1019 ---- break; case CircleStrategyNumberGroup: { ! CIRCLE *query = PG_GETARG_CIRCLE_P(1); result = DatumGetBool(DirectFunctionCall5( ! gist_circle_consistent, ! PointerGetDatum(entry), ! CirclePGetDatum(query), ! Int16GetDatum(RTOverlapStrategyNumber), ! 0, PointerGetDatum(recheck))); if (GIST_LEAF(entry) && result) { *************** gist_point_consistent(PG_FUNCTION_ARGS) *** 1021,1040 **** * We are on leaf page and quick check shows overlapping * of polygon's bounding box and point */ ! BOX *box = DatumGetBoxP(entry->key); Assert(box->high.x == box->low.x ! && box->high.y == box->low.y); result = DatumGetBool(DirectFunctionCall2( ! circle_contain_pt, ! CirclePGetDatum(query), PointPGetDatum(&box->high))); *recheck = false; } } break; default: ! result = false; /* silence compiler warning */ elog(ERROR, "unknown strategy number: %d", strategy); } --- 1021,1040 ---- * We are on leaf page and quick check shows overlapping * of polygon's bounding box and point */ ! BOX *box = DatumGetBoxP(entry->key); Assert(box->high.x == box->low.x ! && box->high.y == box->low.y); result = DatumGetBool(DirectFunctionCall2( ! circle_contain_pt, ! CirclePGetDatum(query), PointPGetDatum(&box->high))); *recheck = false; } } break; default: ! result = false; /* silence compiler warning */ elog(ERROR, "unknown strategy number: %d", strategy); }