summaryrefslogtreecommitdiff
path: root/src/backend/access/rtree/rtree.c
diff options
context:
space:
mode:
authorTom Lane2000-07-30 20:44:02 +0000
committerTom Lane2000-07-30 20:44:02 +0000
commit3a9a74a09dc28268635e0a4c81411ab274d7adac (patch)
tree466fcff1978a23a2c0c706c57444bdc9e647d7f2 /src/backend/access/rtree/rtree.c
parentd70d46fd6076171d9834f11af3a5d65ccc976289 (diff)
Convert all remaining geometric operators to new fmgr style. This
allows fixing problems with operators that expected to be able to return a NULL, such as the '#' line-segment-intersection operator that tried to return NULL when the two segments don't intersect. (See, eg, bug report from 1-Nov-99 on pghackers.) Fix some other bugs in passing, such as backwards comparison in path_distance().
Diffstat (limited to 'src/backend/access/rtree/rtree.c')
-rw-r--r--src/backend/access/rtree/rtree.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index 583baa534a3..d36bf79a8d5 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.52 2000/07/14 22:17:36 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.53 2000/07/30 20:43:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -745,13 +745,16 @@ picksplit(Relation r,
DatumGetPointer(FunctionCall2(&rtstate->interFn,
PointerGetDatum(datum_alpha),
PointerGetDatum(datum_beta)));
+ /* The interFn may return a NULL pointer (not an SQL null!)
+ * to indicate no intersection. sizeFn must cope with this.
+ */
FunctionCall2(&rtstate->sizeFn,
PointerGetDatum(inter_d),
PointerGetDatum(&size_inter));
size_waste = size_union - size_inter;
- pfree(union_d);
-
+ if (union_d != (char *) NULL)
+ pfree(union_d);
if (inter_d != (char *) NULL)
pfree(inter_d);
@@ -1051,7 +1054,8 @@ _rtdump(Relation r)
itoffno = ItemPointerGetOffsetNumber(&(itup->t_tid));
datum = ((char *) itup);
datum += sizeof(IndexTupleData);
- itkey = (char *) box_out((BOX *) datum);
+ itkey = DatumGetCString(DirectFunctionCall1(box_out,
+ PointerGetDatum(datum)));
printf("\t[%d] size %d heap <%d,%d> key:%s\n",
offnum, IndexTupleSize(itup), itblkno, itoffno, itkey);
pfree(itkey);