MCPcopy Create free account
hub / github.com/apache/cloudberry / transformContainerType

Function transformContainerType

src/backend/parser/parse_node.c:193–216  ·  view source on GitHub ↗

* transformContainerType() * Identify the actual container type for a subscripting operation. * * containerType/containerTypmod are modified if necessary to identify * the actual container type and typmod. This mainly involves smashing * any domain to its base type, but there are some special considerations. * Note that caller still needs to check if the result type is a container. */

Source from the content-addressed store, hash-verified

191 * Note that caller still needs to check if the result type is a container.
192 */
193void
194transformContainerType(Oid *containerType, int32 *containerTypmod)
195{
196 /*
197 * If the input is a domain, smash to base type, and extract the actual
198 * typmod to be applied to the base type. Subscripting a domain is an
199 * operation that necessarily works on the base container type, not the
200 * domain itself. (Note that we provide no method whereby the creator of a
201 * domain over a container type could hide its ability to be subscripted.)
202 */
203 *containerType = getBaseTypeAndTypmod(*containerType, containerTypmod);
204
205 /*
206 * We treat int2vector and oidvector as though they were domains over
207 * int2[] and oid[]. This is needed because array slicing could create an
208 * array that doesn't satisfy the dimensionality constraints of the
209 * xxxvector type; so we want the result of a slice operation to be
210 * considered to be of the more general type.
211 */
212 if (*containerType == INT2VECTOROID)
213 *containerType = INT2ARRAYOID;
214 else if (*containerType == OIDVECTOROID)
215 *containerType = OIDARRAYOID;
216}
217
218/*
219 * transformContainerSubscripts()

Callers 2

Calls 1

getBaseTypeAndTypmodFunction · 0.85

Tested by

no test coverage detected