BTW, I observe that with MAXDIM gone from execExpr.h, there are
no widely-visible uses of MAXDIM except for array.h.  I therefore
suggest that we should pull "#define MAXDIM" out of c.h and put it
into array.h, as attached.  I was slightly surprised to find that
this seems to entail *no* new inclusions of array.h ... I expected
there would be one or two.  But the main point here is we want to
restrict use of that symbol to stuff that's tightly integrated with
varlena-array handling, so it ought not be in c.h.

                        regards, tom lane

diff --git a/src/include/c.h b/src/include/c.h
index 12ea056a35..7bc4b8a001 100644
--- a/src/include/c.h
+++ b/src/include/c.h
@@ -591,10 +591,6 @@ typedef uint32 CommandId;
 #define FirstCommandId	((CommandId) 0)
 #define InvalidCommandId	(~(CommandId)0)
 
-/*
- * Maximum number of array subscripts, for regular varlena arrays
- */
-#define MAXDIM 6
 
 /* ----------------
  *		Variable-length datatypes all share the 'struct varlena' header.
diff --git a/src/include/utils/array.h b/src/include/utils/array.h
index 2809dfee93..16925880a1 100644
--- a/src/include/utils/array.h
+++ b/src/include/utils/array.h
@@ -69,6 +69,11 @@ struct ExprState;
 struct ExprContext;
 
 
+/*
+ * Maximum number of array subscripts (arbitrary limit)
+ */
+#define MAXDIM 6
+
 /*
  * Arrays are varlena objects, so must meet the varlena convention that
  * the first int32 of the object contains the total object size in bytes.

Reply via email to