@@ -201,13 +201,18 @@ make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location)
201201
202202/* NOTE: extra code for array type with isn't affect on other types
203203 * transformArrayType()
204- * Identify the types involved in a subscripting operation
204+ * Identify the types involved in a subscripting operation for array
205205 *
206206 * On entry, arrayType/arrayTypmod identify the type of the input value
207207 * to be subscripted (which could be a domain type). These are modified
208208 * if necessary to identify the actual array type and typmod, and the
209209 * array's element type is returned. An error is thrown if the input isn't
210210 * an array type.
211+ *
212+ * NOTE: This part of type-specific code is not separated into type-specific
213+ * subscription procedure for now, but it does not affect on the whole logic,
214+ * since InvalidOid will be return in case of other types not an error.
215+ * An error will appears only if a subscription procedure is not defined.
211216 */
212217Oid
213218transformArrayType (Oid * containerType , int32 * containerTypmod )
@@ -257,29 +262,36 @@ transformArrayType(Oid *containerType, int32 *containerTypmod)
257262 * Transform container subscripting. This is used for both
258263 * container fetch and container assignment.
259264 *
260- * In a container fetch, we are given a source container value and we produce an
261- * expression that represents the result of extracting a single container element
262- * or a container slice.
265+ * In a container fetch, we are given a source container value and we produce
266+ * an expression that represents the result of extracting a single container
267+ * element or a container slice.
263268 *
264269 * In a container assignment, we are given a destination container value plus a
265- * source value that is to be assigned to a single element or a slice of
266- * that container. We produce an expression that represents the new container value
270+ * source value that is to be assigned to a single element or a slice of that
271+ * container. We produce an expression that represents the new container value
267272 * with the source data inserted into the right part of the container.
268273 *
269- * For both cases, if the source container is of a domain-over-container type,
270- * the result is of the base container type or its element type; essentially,
271- * we must fold a domain to its base type before applying subscripting.
272- * (Note that int2vector and oidvector are treated as domains here.)
274+ * For both cases, this function contains only general subscription logic while
275+ * type-specific logic (e.g. type verifications and coersion) is placend in
276+ * separate procedure indicated by typsubscription. There is only one exception
277+ * for now about domain-over-container, if the source container is of a
278+ * domain-over-container type, the result is of the base container type or its
279+ * element type; essentially, we must fold a domain to its base type before
280+ * applying subscripting. (Note that int2vector and oidvector are treated as
281+ * domains here.) If domain verification failed we assume, that element type
282+ * must be the same as container type (e.g. in case of jsonb).
283+ * An error will appear in case if current container type doesn't have a
284+ * subscription procedure.
273285 *
274- * pstate Parse state
286+ * pstate Parse state
275287 * containerBase Already-transformed expression for the container as a whole
276288 * containerType OID of container's datatype (should match type of containerBase,
277- * or be the base type of containerBase's domain type)
278- * elementType OID of container's element type (fetch with transformcontainerType ,
279- * or pass InvalidOid to do it here)
289+ * or be the base type of containerBase's domain type)
290+ * elementType OID of container's element type (fetch with transformArrayType ,
291+ * or pass InvalidOid to do it here)
280292 * containerTypMod typmod for the container (which is also typmod for the elements)
281- * indirection Untransformed list of subscripts (must not be NIL)
282- * assignFrom NULL for container fetch, else transformed expression for source.
293+ * indirection Untransformed list of subscripts (must not be NIL)
294+ * assignFrom NULL for container fetch, else transformed expression for source.
283295 */
284296
285297SubscriptionRef *
0 commit comments