1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +03:00

Renaming for new subscripting mechanism

Over at patch https://commitfest.postgresql.org/21/1062/ Dmitry wants to
introduce a more generic subscription mechanism, which allows
subscripting not only arrays but also other object types such as JSONB.
That functionality is introduced in a largish invasive patch, out of
which this internal renaming patch was extracted.

Author: Dmitry Dolgov
Reviewed-by: Tom Lane, Arthur Zakirov
Discussion: https://postgr.es/m/CA+q6zcUK4EqPAu7XRRO5CCjMwhz5zvg+rfWuLzVoxp_5sKS6=w@mail.gmail.com
This commit is contained in:
Alvaro Herrera
2019-02-01 12:50:32 -03:00
parent f831d4accd
commit 558d77f20e
26 changed files with 555 additions and 523 deletions

View File

@ -951,7 +951,7 @@ process_matched_tle(TargetEntry *src_tle,
/*----------
* Multiple assignments to same attribute. Allow only if all are
* FieldStore or ArrayRef assignment operations. This is a bit
* FieldStore or SubscriptingRef assignment operations. This is a bit
* tricky because what we may actually be looking at is a nest of
* such nodes; consider
* UPDATE tab SET col.fld1.subfld1 = x, col.fld2.subfld2 = y
@ -959,7 +959,7 @@ process_matched_tle(TargetEntry *src_tle,
* FieldStore(col, fld1, FieldStore(placeholder, subfld1, x))
* FieldStore(col, fld2, FieldStore(placeholder, subfld2, y))
* However, we can ignore the substructure and just consider the top
* FieldStore or ArrayRef from each assignment, because it works to
* FieldStore or SubscriptingRef from each assignment, because it works to
* combine these as
* FieldStore(FieldStore(col, fld1,
* FieldStore(placeholder, subfld1, x)),
@ -969,7 +969,7 @@ process_matched_tle(TargetEntry *src_tle,
*
* For FieldStore, instead of nesting we can generate a single
* FieldStore with multiple target fields. We must nest when
* ArrayRefs are involved though.
* SubscriptingRefs are involved though.
*
* As a further complication, the destination column might be a domain,
* resulting in each assignment containing a CoerceToDomain node over a
@ -1048,13 +1048,13 @@ process_matched_tle(TargetEntry *src_tle,
}
newexpr = (Node *) fstore;
}
else if (IsA(src_expr, ArrayRef))
else if (IsA(src_expr, SubscriptingRef))
{
ArrayRef *aref = makeNode(ArrayRef);
SubscriptingRef *sbsref = makeNode(SubscriptingRef);
memcpy(aref, src_expr, sizeof(ArrayRef));
aref->refexpr = (Expr *) prior_expr;
newexpr = (Node *) aref;
memcpy(sbsref, src_expr, sizeof(SubscriptingRef));
sbsref->refexpr = (Expr *) prior_expr;
newexpr = (Node *) sbsref;
}
else
{
@ -1091,14 +1091,16 @@ get_assignment_input(Node *node)
return (Node *) fstore->arg;
}
else if (IsA(node, ArrayRef))
else if (IsA(node, SubscriptingRef))
{
ArrayRef *aref = (ArrayRef *) node;
SubscriptingRef *sbsref = (SubscriptingRef *) node;
if (aref->refassgnexpr == NULL)
if (sbsref->refassgnexpr == NULL)
return NULL;
return (Node *) aref->refexpr;
return (Node *) sbsref->refexpr;
}
return NULL;
}