diff --git a/src/include/utils/builtins.h b/src/include/utils/builtins.h
index 3cf0686f7d..7599deb9ad 100644
--- a/src/include/utils/builtins.h
+++ b/src/include/utils/builtins.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: builtins.h,v 1.19 1997/06/23 15:03:38 thomas Exp $
+ * $Id: builtins.h,v 1.20 1997/07/29 16:16:10 thomas Exp $
  *
  * NOTES
  *    This should normally only be included by fmgr.h.
@@ -253,7 +253,7 @@ extern bool intervalct(TimeInterval i1, TimeInterval i2);
 extern bool intervalov(TimeInterval i1, TimeInterval i2);
 extern AbsoluteTime intervalstart(TimeInterval i);
 extern AbsoluteTime intervalend(TimeInterval i);
-extern int isreltime(char *timestring, int *sign, long *quantity, int *unitnr);
+extern int isreltime(char *timestring);
 extern text *timeofday(void);
 
 /* dt.c */
@@ -474,6 +474,7 @@ extern bool text_lt(struct varlena *arg1, struct varlena *arg2);
 extern bool text_le(struct varlena *arg1, struct varlena *arg2);
 extern bool text_gt(struct varlena *arg1, struct varlena *arg2);
 extern bool text_ge(struct varlena *arg1, struct varlena *arg2);
+extern int32 textpos(text* t1, text* t2);
 extern int32 byteaGetSize(struct varlena *v);
 extern int32 byteaGetByte(struct varlena *v, int32 n);
 extern int32 byteaGetBit(struct varlena *v, int32 n);
diff --git a/src/include/utils/dt.h b/src/include/utils/dt.h
index edf9715f93..fb8c26d980 100644
--- a/src/include/utils/dt.h
+++ b/src/include/utils/dt.h
@@ -8,7 +8,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: dt.h,v 1.14 1997/07/29 14:08:21 momjian Exp $
+ * $Id: dt.h,v 1.15 1997/07/29 16:16:12 thomas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -99,7 +99,7 @@ typedef struct {
 #define MONTH	1
 #define YEAR	2
 #define DAY	3
-#define TIME	4
+#define TIMES	4	/* not used - thomas 1997-07-14 */
 #define TZ	5
 #define DTZ	6
 #define DTZMOD	7
diff --git a/src/include/utils/geo_decls.h b/src/include/utils/geo_decls.h
index 2109f39e25..034dee7743 100644
--- a/src/include/utils/geo_decls.h
+++ b/src/include/utils/geo_decls.h
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: geo_decls.h,v 1.5 1997/06/03 14:10:32 thomas Exp $
+ * $Id: geo_decls.h,v 1.6 1997/07/29 16:16:13 thomas Exp $
  *
  * NOTE
  *    These routines do *not* use the float types from adt/.
@@ -39,7 +39,9 @@
 #define	FPge(A,B)		((B) - (A) <= EPSILON)
 #else
 #define	FPzero(A)		(A == 0)
+#define	FPnzero(A)		(A != 0)
 #define	FPeq(A,B)		(A == B)
+#define	FPne(A,B)		(A != B)
 #define	FPlt(A,B)		(A < B)
 #define	FPle(A,B)		(A <= B)
 #define	FPgt(A,B)		(A > B)
@@ -98,6 +100,7 @@ typedef	struct {
  *-------------------------------------------------------------------*/
 typedef struct {
 	double	A, B, C;
+
 	double	m;
 } LINE;
 
@@ -133,87 +136,6 @@ typedef struct {
 /* 
  * in geo_ops.h
  */
-extern BOX *box_in(char *str);
-extern char *box_out(BOX *box);
-extern BOX *box_construct(double x1, double x2, double y1, double y2);
-extern BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2);
-extern BOX *box_copy(BOX *box);
-extern bool box_same(BOX *box1, BOX *box2);
-extern bool box_overlap(BOX *box1, BOX *box2);
-extern bool box_overleft(BOX *box1, BOX *box2);
-extern bool box_left(BOX *box1, BOX *box2);
-extern bool box_right(BOX *box1, BOX *box2);
-extern bool box_overright(BOX *box1, BOX *box2);
-extern bool box_contained(BOX *box1, BOX *box2);
-extern bool box_contain(BOX *box1, BOX *box2);
-extern bool box_below(BOX *box1, BOX *box2);
-extern bool box_above(BOX *box1, BOX *box2);
-extern bool box_lt(BOX *box1, BOX *box2);
-extern bool box_gt(BOX *box1, BOX *box2);
-extern bool box_eq(BOX *box1, BOX *box2);
-extern bool box_le(BOX *box1, BOX *box2);
-extern bool box_ge(BOX *box1, BOX *box2);
-extern Point *box_center(BOX *box);
-extern double *box_area(BOX *box);
-extern double *box_length(BOX *box);
-extern double *box_height(BOX *box);
-extern double *box_distance(BOX *box1, BOX *box2);
-extern Point *box_center(BOX *box);
-extern BOX *box_intersect(BOX *box1, BOX *box2);
-extern LSEG *box_diagonal(BOX *box);
-
-/* private routines */
-extern double box_ar(BOX *box);
-extern double box_ln(BOX *box);
-extern double box_ht(BOX *box);
-extern double box_dt(BOX *box1, BOX *box2);
-
-extern BOX *box(Point *p1, Point *p2);
-extern BOX *box_add(BOX *box, Point *p);
-extern BOX *box_sub(BOX *box, Point *p);
-extern BOX *box_mul(BOX *box, Point *p);
-extern BOX *box_div(BOX *box, Point *p);
-
-extern LINE *line_construct_pm(Point *pt, double m);
-extern LINE *line_construct_pp(Point *pt1, Point *pt2);
-extern bool line_intersect(LINE *l1, LINE *l2);
-extern bool line_parallel(LINE *l1, LINE *l2);
-extern bool line_perp(LINE *l1, LINE *l2);
-extern bool line_vertical(LINE *line);
-extern bool line_horizontal(LINE *line);
-extern bool line_eq(LINE *l1, LINE *l2);
-extern double *line_distance(LINE *l1, LINE *l2);
-extern Point *line_interpt(LINE *l1, LINE *l2);
-
-extern PATH *path_in(char *str);
-extern char *path_out(PATH *path);
-extern bool path_n_lt(PATH *p1, PATH *p2);
-extern bool path_n_gt(PATH *p1, PATH *p2);
-extern bool path_n_eq(PATH *p1, PATH *p2);
-extern bool path_n_le(PATH *p1, PATH *p2);
-extern bool path_n_ge(PATH *p1, PATH *p2);
-extern bool path_inter(PATH *p1, PATH *p2);
-extern double *path_distance(PATH *p1, PATH *p2);
-extern double *path_length(PATH *path);
-
-extern bool path_isclosed(PATH *path);
-extern bool path_isopen(PATH *path);
-extern int4 path_npoints(PATH *path);
-
-extern PATH *path_close(PATH *path);
-extern PATH *path_open(PATH *path);
-extern PATH *path_add(PATH *p1, PATH *p2);
-extern PATH *path_add_pt(PATH *path, Point *point);
-extern PATH *path_sub_pt(PATH *path, Point *point);
-extern PATH *path_mul_pt(PATH *path, Point *point);
-extern PATH *path_div_pt(PATH *path, Point *point);
-
-extern POLYGON *path_poly(PATH *path);
-extern PATH *upgradepath(PATH *path);
-extern bool isoldpath(PATH *path);
-
-/* private routines */
-extern double path_ln(PATH *path);
 
 /* public point routines */
 extern Point *point_in(char *str);
@@ -251,10 +173,11 @@ extern bool lseg_vertical(LSEG *lseg);
 extern bool lseg_horizontal(LSEG *lseg);
 extern bool lseg_eq(LSEG *l1, LSEG *l2);
 extern double *lseg_distance(LSEG *l1, LSEG *l2);
+extern Point *lseg_center(LSEG *lseg);
 extern Point *lseg_interpt(LSEG *l1, LSEG *l2);
 extern double *dist_pl(Point *pt, LINE *line);
 extern double *dist_ps(Point *pt, LSEG *lseg);
-extern double *dist_ppth(Point *pt, PATH *path);
+extern double *dist_ppath(Point *pt, PATH *path);
 extern double *dist_pb(Point *pt, BOX *box);
 extern double *dist_sl(LSEG *lseg, LINE *line);
 extern double *dist_sb(LSEG *lseg, BOX *box);
@@ -282,6 +205,97 @@ extern void statlseg_construct(LSEG *lseg, Point *pt1, Point *pt2);
 extern double lseg_dt(LSEG *l1, LSEG *l2);
 extern void make_bound_box(POLYGON *poly);
 
+/* public box routines */
+extern BOX *box_in(char *str);
+extern char *box_out(BOX *box);
+extern bool box_same(BOX *box1, BOX *box2);
+extern bool box_overlap(BOX *box1, BOX *box2);
+extern bool box_overleft(BOX *box1, BOX *box2);
+extern bool box_left(BOX *box1, BOX *box2);
+extern bool box_right(BOX *box1, BOX *box2);
+extern bool box_overright(BOX *box1, BOX *box2);
+extern bool box_contained(BOX *box1, BOX *box2);
+extern bool box_contain(BOX *box1, BOX *box2);
+extern bool box_below(BOX *box1, BOX *box2);
+extern bool box_above(BOX *box1, BOX *box2);
+extern bool box_lt(BOX *box1, BOX *box2);
+extern bool box_gt(BOX *box1, BOX *box2);
+extern bool box_eq(BOX *box1, BOX *box2);
+extern bool box_le(BOX *box1, BOX *box2);
+extern bool box_ge(BOX *box1, BOX *box2);
+extern Point *box_center(BOX *box);
+extern double *box_area(BOX *box);
+extern double *box_width(BOX *box);
+extern double *box_height(BOX *box);
+extern double *box_distance(BOX *box1, BOX *box2);
+extern Point *box_center(BOX *box);
+extern BOX *box_intersect(BOX *box1, BOX *box2);
+extern LSEG *box_diagonal(BOX *box);
+
+/* private routines */
+extern BOX *box_construct(double x1, double x2, double y1, double y2);
+extern BOX *box_fill(BOX *result, double x1, double x2, double y1, double y2);
+extern BOX *box_copy(BOX *box);
+
+extern double box_ar(BOX *box);
+extern double box_wd(BOX *box);
+extern double box_ht(BOX *box);
+extern double box_dt(BOX *box1, BOX *box2);
+
+extern BOX *box(Point *p1, Point *p2);
+extern BOX *box_add(BOX *box, Point *p);
+extern BOX *box_sub(BOX *box, Point *p);
+extern BOX *box_mul(BOX *box, Point *p);
+extern BOX *box_div(BOX *box, Point *p);
+
+/* private line routines */
+extern LINE *line_construct_pm(Point *pt, double m);
+extern LINE *line_construct_pp(Point *pt1, Point *pt2);
+extern bool line_intersect(LINE *l1, LINE *l2);
+extern bool line_parallel(LINE *l1, LINE *l2);
+extern bool line_perp(LINE *l1, LINE *l2);
+extern bool line_vertical(LINE *line);
+extern bool line_horizontal(LINE *line);
+extern bool line_eq(LINE *l1, LINE *l2);
+extern double *line_distance(LINE *l1, LINE *l2);
+extern Point *line_interpt(LINE *l1, LINE *l2);
+
+/* public path routines */
+extern PATH *path_in(char *str);
+extern char *path_out(PATH *path);
+extern bool path_n_lt(PATH *p1, PATH *p2);
+extern bool path_n_gt(PATH *p1, PATH *p2);
+extern bool path_n_eq(PATH *p1, PATH *p2);
+extern bool path_n_le(PATH *p1, PATH *p2);
+extern bool path_n_ge(PATH *p1, PATH *p2);
+extern bool path_inter(PATH *p1, PATH *p2);
+extern double *path_distance(PATH *p1, PATH *p2);
+extern double *path_length(PATH *path);
+
+extern bool path_isclosed(PATH *path);
+extern bool path_isopen(PATH *path);
+extern int4 path_npoints(PATH *path);
+
+extern PATH *path_close(PATH *path);
+extern PATH *path_open(PATH *path);
+extern PATH *path_add(PATH *p1, PATH *p2);
+extern PATH *path_add_pt(PATH *path, Point *point);
+extern PATH *path_sub_pt(PATH *path, Point *point);
+extern PATH *path_mul_pt(PATH *path, Point *point);
+extern PATH *path_div_pt(PATH *path, Point *point);
+extern bool path_contain_pt( PATH *path, Point *p);
+extern bool pt_contained_path( Point *p, PATH *path);
+
+extern Point *path_center(PATH *path);
+extern POLYGON *path_poly(PATH *path);
+
+extern PATH *upgradepath(PATH *path);
+extern bool isoldpath(PATH *path);
+
+/* private routines */
+extern double path_ln(PATH *path);
+extern bool plist_same(int npts, Point p1[], Point p2[]);
+
 /* public polygon routines */
 extern POLYGON *poly_in(char *s);
 extern char *poly_out(POLYGON *poly);
@@ -293,14 +307,21 @@ extern bool poly_same(POLYGON *polya, POLYGON *polyb);
 extern bool poly_overlap(POLYGON *polya, POLYGON *polyb);
 extern bool poly_contain(POLYGON *polya, POLYGON *polyb);
 extern bool poly_contained(POLYGON *polya, POLYGON *polyb);
+extern bool poly_contain_pt( POLYGON *poly, Point *p);
+extern bool pt_contained_poly( Point *p, POLYGON *poly);
 
+extern double *poly_distance(POLYGON *polya, POLYGON *polyb);
 extern int4 poly_npoints(POLYGON *poly);
+extern Point *poly_center(POLYGON *poly);
 extern BOX *poly_box(POLYGON *poly);
 extern PATH *poly_path(POLYGON *poly);
 extern POLYGON *box_poly(BOX *box);
+
 extern POLYGON *upgradepoly(POLYGON *poly);
 extern POLYGON *revertpoly(POLYGON *poly);
 
+/* private polygon routines */
+
 /* public circle routines */
 extern CIRCLE *circle_in(char *str);
 extern char *circle_out(CIRCLE *circle);
@@ -321,6 +342,8 @@ extern bool circle_lt(CIRCLE *circle1, CIRCLE *circle2);
 extern bool circle_gt(CIRCLE *circle1, CIRCLE *circle2);
 extern bool circle_le(CIRCLE *circle1, CIRCLE *circle2);
 extern bool circle_ge(CIRCLE *circle1, CIRCLE *circle2);
+extern bool circle_contain_pt(CIRCLE *circle, Point *point);
+extern bool pt_contained_circle(Point *point, CIRCLE *circle);
 extern CIRCLE *circle_add_pt(CIRCLE *circle, Point *point);
 extern CIRCLE *circle_sub_pt(CIRCLE *circle, Point *point);
 extern CIRCLE *circle_mul_pt(CIRCLE *circle, Point *point);
@@ -330,8 +353,11 @@ extern double *circle_diameter(CIRCLE *circle);
 extern double *circle_radius(CIRCLE *circle);
 extern double *circle_distance(CIRCLE *circle1, CIRCLE *circle2);
 extern double *dist_pc(Point *point, CIRCLE *circle);
+extern double *dist_cpoly(CIRCLE *circle, POLYGON *poly);
 extern Point *circle_center(CIRCLE *circle);
 extern CIRCLE *circle(Point *center, float8 *radius);
+extern CIRCLE *box_circle(BOX *box);
+extern BOX *circle_box(CIRCLE *circle);
 extern CIRCLE *poly_circle(POLYGON *poly);
 extern POLYGON *circle_poly(int npts, CIRCLE *circle);
 
diff --git a/src/include/utils/nabstime.h b/src/include/utils/nabstime.h
index 09d8272456..0d6888e1d7 100644
--- a/src/include/utils/nabstime.h
+++ b/src/include/utils/nabstime.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nabstime.h,v 1.8 1997/06/23 14:58:51 thomas Exp $
+ * $Id: nabstime.h,v 1.9 1997/07/29 16:16:14 thomas Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -43,10 +43,10 @@ typedef TimeIntervalData *TimeInterval;
  *  so redefine them explicitly using these bit patterns. - tgl 97/02/24
  */
 #define EPOCH_ABSTIME	((AbsoluteTime) 0)
-#define INVALID_ABSTIME ((AbsoluteTime) 0x4FFFFFFE) /* 2147483647 == 2^31 - 1 */
-#define CURRENT_ABSTIME ((AbsoluteTime) 0x4FFFFFFD) /* 2147483646 == 2^31 - 2 */
-#define NOEND_ABSTIME	((AbsoluteTime) 0x4FFFFFFC) /* 2147483645 == 2^31 - 3 */
-#define BIG_ABSTIME	((AbsoluteTime) 0x4FFFFFFB) /* 2147483644 == 2^31 - 4 */
+#define INVALID_ABSTIME ((AbsoluteTime) 0x7FFFFFFE) /* 2147483647 == 2^31 - 1 */
+#define CURRENT_ABSTIME ((AbsoluteTime) 0x7FFFFFFD) /* 2147483646 == 2^31 - 2 */
+#define NOEND_ABSTIME	((AbsoluteTime) 0x7FFFFFFC) /* 2147483645 == 2^31 - 3 */
+#define BIG_ABSTIME	((AbsoluteTime) 0x7FFFFFFB) /* 2147483644 == 2^31 - 4 */
 
 #if defined(aix)
 /*
@@ -55,14 +55,12 @@ typedef TimeIntervalData *TimeInterval;
  * these integer constants depending on whether the constant is signed 
  * or not!
  */
-/*#define NOSTART_ABSTIME	((AbsoluteTime) HIBITI)	*/	/* - 2^31 */
 #define NOSTART_ABSTIME      ((AbsoluteTime) INT_MIN)
 #else
-/*#define NOSTART_ABSTIME ((AbsoluteTime) 2147483648)*/	/* - 2^31 */
 #define NOSTART_ABSTIME ((AbsoluteTime) 0x80000001) /* -2147483647 == - 2^31 */
 #endif /* aix */
 
-#define INVALID_RELTIME ((RelativeTime) 0x4FFFFFFE) /* 2147483647 == 2^31 - 1 */
+#define INVALID_RELTIME ((RelativeTime) 0x7FFFFFFE) /* 2147483647 == 2^31 - 1 */
 
 #define AbsoluteTimeIsValid(time) \
     ((bool) ((time) != INVALID_ABSTIME))