diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index f864338897037c3a63e6bcebb4cf496b5ac79da8..1b6a4d9e0fda055d1278b5a0fdb8b5fc2fc62929 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.81 2002/09/18 21:35:22 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/arrayfuncs.c,v 1.82 2002/11/08 17:27:02 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -866,6 +866,65 @@ array_dims(PG_FUNCTION_ARGS)
 	PG_RETURN_TEXT_P(result);
 }
 
+/*-----------------------------------------------------------------------------
+ * array_lower :
+ *		returns the lower dimension, of the DIM requested, for
+ *		the array pointed to by "v", as an int4
+ *----------------------------------------------------------------------------
+ */
+Datum
+array_lower(PG_FUNCTION_ARGS)
+{
+	ArrayType  *v = PG_GETARG_ARRAYTYPE_P(0);
+	int			reqdim = PG_GETARG_INT32(1);
+	int		   *lb;
+	int			result;
+
+	/* Sanity check: does it look like an array at all? */
+	if (ARR_NDIM(v) <= 0 || ARR_NDIM(v) > MAXDIM)
+		PG_RETURN_NULL();
+
+	/* Sanity check: was the requested dim valid */
+	if (reqdim <= 0 || reqdim > ARR_NDIM(v))
+		PG_RETURN_NULL();
+
+	lb = ARR_LBOUND(v);
+	result = lb[reqdim - 1];
+
+	PG_RETURN_INT32(result);
+}
+
+/*-----------------------------------------------------------------------------
+ * array_upper :
+ *		returns the upper dimension, of the DIM requested, for
+ *		the array pointed to by "v", as an int4
+ *----------------------------------------------------------------------------
+ */
+Datum
+array_upper(PG_FUNCTION_ARGS)
+{
+	ArrayType  *v = PG_GETARG_ARRAYTYPE_P(0);
+	int			reqdim = PG_GETARG_INT32(1);
+	int		   *dimv,
+			   *lb;
+	int			result;
+
+	/* Sanity check: does it look like an array at all? */
+	if (ARR_NDIM(v) <= 0 || ARR_NDIM(v) > MAXDIM)
+		PG_RETURN_NULL();
+
+	/* Sanity check: was the requested dim valid */
+	if (reqdim <= 0 || reqdim > ARR_NDIM(v))
+		PG_RETURN_NULL();
+
+	lb = ARR_LBOUND(v);
+	dimv = ARR_DIMS(v);
+
+	result = dimv[reqdim - 1] + lb[reqdim - 1] - 1;
+
+	PG_RETURN_INT32(result);
+}
+
 /*---------------------------------------------------------------------------
  * array_ref :
  *	  This routine takes an array pointer and an index array and returns
diff --git a/src/include/catalog/catversion.h b/src/include/catalog/catversion.h
index 9c00121875d8defe1cd5621efd16d54086a74fce..f8150787c1accf3e09e9e0c66b68cdfe3d72b6df 100644
--- a/src/include/catalog/catversion.h
+++ b/src/include/catalog/catversion.h
@@ -37,7 +37,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: catversion.h,v 1.163 2002/11/02 18:41:22 tgl Exp $
+ * $Id: catversion.h,v 1.164 2002/11/08 17:27:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,6 @@
  */
 
 /*							yyyymmddN */
-#define CATALOG_VERSION_NO	200211021
+#define CATALOG_VERSION_NO	200211081
 
 #endif
diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h
index 9b8dc089430ffc46e397ac94c60385f2f9287531..f956129acfee7233c3c9f18bb4e58849c86cbb76 100644
--- a/src/include/catalog/pg_proc.h
+++ b/src/include/catalog/pg_proc.h
@@ -7,7 +7,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_proc.h,v 1.275 2002/11/02 18:41:22 tgl Exp $
+ * $Id: pg_proc.h,v 1.276 2002/11/08 17:27:03 momjian Exp $
  *
  * NOTES
  *	  The script catalog/genbki.sh reads this file and generates .bki
@@ -1000,6 +1000,10 @@ DATA(insert OID = 750 (  array_in		   PGNSP PGUID 12 f f t f s 3 2277 "2275 26 2
 DESCR("array");
 DATA(insert OID = 751 (  array_out		   PGNSP PGUID 12 f f t f s 1 2275 "2277"  array_out - _null_ ));
 DESCR("array");
+DATA(insert OID = 2091 (  array_lower	   PGNSP PGUID 12 f f t f i 2 23 "2277 23" array_lower - _null_ ));
+DESCR("array lower dimension");
+DATA(insert OID = 2092 (  array_upper	   PGNSP PGUID 12 f f t f i 2 23 "2277 23" array_upper - _null_ ));
+DESCR("array upper dimension");
 
 DATA(insert OID = 760 (  smgrin			   PGNSP PGUID 12 f f t f s 1 210 "2275"  smgrin - _null_ ));
 DESCR("storage manager(internal)");
diff --git a/src/include/utils/array.h b/src/include/utils/array.h
index 639d9dc31535b0eb16473cdb185815d3acc433ee..1d154f485eb1dbb0723c4a763a4509e2d833cd07 100644
--- a/src/include/utils/array.h
+++ b/src/include/utils/array.h
@@ -10,7 +10,7 @@
  * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
- * $Id: array.h,v 1.35 2002/09/18 21:35:24 tgl Exp $
+ * $Id: array.h,v 1.36 2002/11/08 17:27:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -85,6 +85,8 @@ extern Datum array_out(PG_FUNCTION_ARGS);
 extern Datum array_length_coerce(PG_FUNCTION_ARGS);
 extern Datum array_eq(PG_FUNCTION_ARGS);
 extern Datum array_dims(PG_FUNCTION_ARGS);
+extern Datum array_lower(PG_FUNCTION_ARGS);
+extern Datum array_upper(PG_FUNCTION_ARGS);
 
 extern Datum array_ref(ArrayType *array, int nSubscripts, int *indx,
 		  int arraylen, int elmlen, bool elmbyval, char elmalign,