@@ -311,7 +311,7 @@ transformArraySubscripts(ParseState *pstate,
311311elementType = transformArrayType (& arrayType ,& arrayTypMod );
312312
313313/*
314- * A list containing only single subscripts(uidx) refers to a single array
314+ * A list containing only single subscripts refers to a single array
315315 * element. If any of the items are double subscripts (lower:upper), then
316316 * the subscript expression means an array slice operation. In this case,
317317 * we supply a default lower bound of 1 for any items that contain only a
@@ -322,7 +322,7 @@ transformArraySubscripts(ParseState *pstate,
322322{
323323A_Indices * ai = (A_Indices * )lfirst (idx );
324324
325- if (ai -> lidx != NULL || ai -> lidx_default )
325+ if (ai -> lidx != NULL )
326326{
327327isSlice = true;
328328break ;
@@ -335,17 +335,9 @@ transformArraySubscripts(ParseState *pstate,
335335foreach (idx ,indirection )
336336{
337337A_Indices * ai = (A_Indices * )lfirst (idx );
338- Node * subexpr = NULL ;
338+ Node * subexpr ;
339339
340340Assert (IsA (ai ,A_Indices ));
341- if ((ai -> uidx_default || ai -> lidx_default )&& assignFrom != NULL )
342- ereport (ERROR ,
343- (errcode (ERRCODE_ARRAY_SUBSCRIPT_ERROR ),
344- errmsg ("array subscript must have both boundaries" ),
345- errhint ("You can't omit the upper or lower"
346- " boundaries when updating or inserting" ),
347- parser_errposition (pstate ,exprLocation (arrayBase ))));
348-
349341if (isSlice )
350342{
351343if (ai -> lidx )
@@ -364,7 +356,7 @@ transformArraySubscripts(ParseState *pstate,
364356errmsg ("array subscript must have type integer" ),
365357parser_errposition (pstate ,exprLocation (ai -> lidx ))));
366358}
367- else if ( ai -> lidx_default == false)
359+ else
368360{
369361/* Make a constant 1 */
370362subexpr = (Node * )makeConst (INT4OID ,
@@ -377,26 +369,19 @@ transformArraySubscripts(ParseState *pstate,
377369}
378370lowerIndexpr = lappend (lowerIndexpr ,subexpr );
379371}
380-
381- if (ai -> uidx_default == false)
382- {
383- subexpr = transformExpr (pstate ,ai -> uidx ,pstate -> p_expr_kind );
384- /* If it's not int4 already, try to coerce */
385- subexpr = coerce_to_target_type (pstate ,
386- subexpr ,exprType (subexpr ),
387- INT4OID ,-1 ,
388- COERCION_ASSIGNMENT ,
389- COERCE_IMPLICIT_CAST ,
390- -1 );
391- if (subexpr == NULL )
392- ereport (ERROR ,
393- (errcode (ERRCODE_DATATYPE_MISMATCH ),
394- errmsg ("array subscript must have type integer" ),
395- parser_errposition (pstate ,exprLocation (ai -> uidx ))));
396- }
397- else
398- subexpr = NULL ;
399-
372+ subexpr = transformExpr (pstate ,ai -> uidx ,pstate -> p_expr_kind );
373+ /* If it's not int4 already, try to coerce */
374+ subexpr = coerce_to_target_type (pstate ,
375+ subexpr ,exprType (subexpr ),
376+ INT4OID ,-1 ,
377+ COERCION_ASSIGNMENT ,
378+ COERCE_IMPLICIT_CAST ,
379+ -1 );
380+ if (subexpr == NULL )
381+ ereport (ERROR ,
382+ (errcode (ERRCODE_DATATYPE_MISMATCH ),
383+ errmsg ("array subscript must have type integer" ),
384+ parser_errposition (pstate ,exprLocation (ai -> uidx ))));
400385upperIndexpr = lappend (upperIndexpr ,subexpr );
401386}
402387