summaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorMarc G. Fournier1996-07-20 07:59:41 +0000
committerMarc G. Fournier1996-07-20 07:59:41 +0000
commit94215d51c82eca99a21e0e7b1a43054b909bac6f (patch)
tree3f6c861ee28555abf189311bd8f11d7369201560 /src/backend/parser
parentbaeb3aadc5c60611570ff2bb525e6a3f941c1c22 (diff)
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>
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/analyze.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 3f44037ca7..cba2e21199 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -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
*/