@@ -201,13 +201,18 @@ make_var(ParseState *pstate, RangeTblEntry *rte, int attrno, int location)
201
201
202
202
/* NOTE: extra code for array type with isn't affect on other types
203
203
* transformArrayType()
204
- *Identify the types involved in a subscripting operation
204
+ *Identify the types involved in a subscripting operation for array
205
205
*
206
206
* On entry, arrayType/arrayTypmod identify the type of the input value
207
207
* to be subscripted (which could be a domain type). These are modified
208
208
* if necessary to identify the actual array type and typmod, and the
209
209
* array's element type is returned. An error is thrown if the input isn't
210
210
* 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.
211
216
*/
212
217
Oid
213
218
transformArrayType (Oid * containerType ,int32 * containerTypmod )
@@ -257,29 +262,36 @@ transformArrayType(Oid *containerType, int32 *containerTypmod)
257
262
*Transform container subscripting. This is used for both
258
263
*container fetch and container assignment.
259
264
*
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.
263
268
*
264
269
* 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
267
272
* with the source data inserted into the right part of the container.
268
273
*
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.
273
285
*
274
- * pstateParse state
286
+ * pstate Parse state
275
287
* containerBaseAlready-transformed expression for the container as a whole
276
288
* containerTypeOID of container's datatype (should match type of containerBase,
277
- *or be the base type of containerBase's domain type)
278
- * elementTypeOID of container's element type (fetch withtransformcontainerType ,
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 withtransformArrayType ,
291
+ * or pass InvalidOid to do it here)
280
292
* containerTypModtypmod for the container (which is also typmod for the elements)
281
- * indirectionUntransformed list of subscripts (must not be NIL)
282
- * assignFromNULL 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.
283
295
*/
284
296
285
297
SubscriptionRef *