mirror of
https://github.com/postgres/postgres.git
synced 2025-07-24 14:22:24 +03:00
Fixes:
The updating of array fields is broken in Postgres95-1.01, An array can be only replaced with a new array but not have some elements modified. This is caused by two bugs in the parser and in the array utilities. Furthermore it is not possible to update array with a base type of variable length. - submitted by: Massimo Dal Zotto <dz@cs.unitn.it>
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.2 1996/07/19 07:24:06 scrappy Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.3 1996/07/20 07:58:04 scrappy Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1386,6 +1386,16 @@ make_targetlist_expr(ParseState *pstate,
|
||||
if (attrtype != type_id) {
|
||||
if (IsA(expr,Const)) {
|
||||
/* try to cast the constant */
|
||||
#ifdef ARRAY_PATCH
|
||||
if (arrayRef && !(((A_Indices *)lfirst(arrayRef))->lidx)) {
|
||||
/* updating a single item */
|
||||
Oid typelem = get_typelem(attrtype);
|
||||
expr = (Node*)parser_typecast2(expr,
|
||||
type_id,
|
||||
get_id_type((long)typelem),
|
||||
attrlen);
|
||||
} else
|
||||
#endif
|
||||
expr = (Node*)parser_typecast2(expr,
|
||||
type_id,
|
||||
get_id_type((long)attrtype),
|
||||
@ -1418,7 +1428,11 @@ make_targetlist_expr(ParseState *pstate,
|
||||
&pstate->p_last_resno);
|
||||
while(ar!=NIL) {
|
||||
A_Indices *ind = lfirst(ar);
|
||||
#ifdef ARRAY_PATCH
|
||||
if (lowerIndexpr || (!upperIndexpr && ind->lidx)) {
|
||||
#else
|
||||
if (lowerIndexpr) {
|
||||
#endif
|
||||
/* XXX assume all lowerIndexpr is non-null in
|
||||
* this case
|
||||
*/
|
||||
|
Reference in New Issue
Block a user