*** pgsql/src/backend/parser/parse_expr.c 2009/11/13 16:09:20 1.241.2.3 --- pgsql/src/backend/parser/parse_expr.c 2009/11/13 19:48:26 1.241.2.4 *************** *** 8,14 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.241.2.2 2009/10/27 17:11:30 tgl Exp $ * *------------------------------------------------------------------------- */ --- 8,14 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/parser/parse_expr.c,v 1.241.2.3 2009/11/13 16:09:20 heikki Exp $ * *------------------------------------------------------------------------- */ *************** transformExpr(ParseState *pstate, Node * *** 164,195 **** elementType = get_element_type(targetType); if (OidIsValid(elementType)) { - result = transformArrayExpr(pstate, - (A_ArrayExpr *) tc->arg, - targetType, - elementType, - targetTypmod); - /* ! * If the target array type is a domain, we still need ! * to check the domain constraint. (coerce_to_domain ! * is a no-op if targetType is not a domain) */ ! result = coerce_to_domain(result, ! InvalidOid, ! -1, ! targetType, ! COERCE_IMPLICIT_CAST, ! tc->location, ! false, ! true); ! break; } - - /* - * Corner case: ARRAY[] cast to a non-array type. Fall - * through to do it the standard way. - */ } result = transformTypeCast(pstate, tc); --- 164,186 ---- elementType = get_element_type(targetType); if (OidIsValid(elementType)) { /* ! * tranformArrayExpr doesn't know how to check domain ! * constraints, so ask it to return the base type ! * instead. transformTypeCast below will cast it to ! * the domain. In the usual case that the target is ! * not a domain, transformTypeCast is a no-op. */ ! targetType = getBaseTypeAndTypmod(targetType, ! &targetTypmod); ! ! tc = copyObject(tc); ! tc->arg = transformArrayExpr(pstate, ! (A_ArrayExpr *) tc->arg, ! targetType, ! elementType, ! targetTypmod); } } result = transformTypeCast(pstate, tc); *************** transformExpr(ParseState *pstate, Node * *** 315,320 **** --- 306,312 ---- case T_ArrayCoerceExpr: case T_ConvertRowtypeExpr: case T_CaseTestExpr: + case T_ArrayExpr: case T_CoerceToDomain: case T_CoerceToDomainValue: case T_SetToDefault: