diff options
Diffstat (limited to 'src/backend/utils/adt/arrayfuncs.c')
-rw-r--r-- | src/backend/utils/adt/arrayfuncs.c | 12 |
1 files changed, 7 insertions, 5 deletions
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, |