aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/parser/parse_expr.c14
-rw-r--r--src/backend/utils/adt/arrayfuncs.c12
2 files changed, 18 insertions, 8 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index bad1df732ea..9caf1e481a2 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -2053,10 +2053,18 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a,
/*
* Check for sub-array expressions, if we haven't already found
- * one.
+ * one. Note we don't accept domain-over-array as a sub-array,
+ * nor int2vector nor oidvector; those have constraints that don't
+ * map well to being treated as a sub-array.
*/
- if (!newa->multidims && type_is_array(exprType(newe)))
- newa->multidims = true;
+ if (!newa->multidims)
+ {
+ Oid newetype = exprType(newe);
+
+ if (newetype != INT2VECTOROID && newetype != OIDVECTOROID &&
+ type_is_array(newetype))
+ newa->multidims = true;
+ }
}
newelems = lappend(newelems, newe);
diff --git a/src/backend/utils/adt/arrayfuncs.c b/src/backend/utils/adt/arrayfuncs.c
index d777f38ed99..c8f53c6fbe7 100644
--- a/src/backend/utils/adt/arrayfuncs.c
+++ b/src/backend/utils/adt/arrayfuncs.c
@@ -5782,9 +5782,14 @@ ArrayBuildStateAny *
initArrayResultAny(Oid input_type, MemoryContext rcontext, bool subcontext)
{
ArrayBuildStateAny *astate;
- Oid element_type = get_element_type(input_type);
- if (OidIsValid(element_type))
+ /*
+ * int2vector and oidvector will satisfy both get_element_type and
+ * get_array_type. We prefer to treat them as scalars, to be consistent
+ * with get_promoted_array_type. Hence, check get_array_type not
+ * get_element_type.
+ */
+ if (!OidIsValid(get_array_type(input_type)))
{
/* Array case */
ArrayBuildStateArr *arraystate;
@@ -5801,9 +5806,6 @@ initArrayResultAny(Oid input_type, MemoryContext rcontext, bool subcontext)
/* Scalar case */
ArrayBuildState *scalarstate;
- /* Let's just check that we have a type that can be put into arrays */
- Assert(OidIsValid(get_array_type(input_type)));
-
scalarstate = initArrayResult(input_type, rcontext, subcontext);
astate = (ArrayBuildStateAny *)
MemoryContextAlloc(scalarstate->mcontext,