MCPcopy Create free account
hub / github.com/apache/cloudberry / transformAssignmentSubscripts

Function transformAssignmentSubscripts

src/backend/parser/parse_target.c:904–1003  ·  view source on GitHub ↗

* helper for transformAssignmentIndirection: process container assignment */

Source from the content-addressed store, hash-verified

902 * helper for transformAssignmentIndirection: process container assignment
903 */
904static Node *
905transformAssignmentSubscripts(ParseState *pstate,
906 Node *basenode,
907 const char *targetName,
908 Oid targetTypeId,
909 int32 targetTypMod,
910 Oid targetCollation,
911 List *subscripts,
912 bool isSlice,
913 List *indirection,
914 ListCell *next_indirection,
915 Node *rhs,
916 CoercionContext ccontext,
917 int location)
918{
919 Node *result;
920 SubscriptingRef *sbsref;
921 Oid containerType;
922 int32 containerTypMod;
923 Oid typeNeeded;
924 int32 typmodNeeded;
925 Oid collationNeeded;
926
927 Assert(subscripts != NIL);
928
929 /* Identify the actual container type involved */
930 containerType = targetTypeId;
931 containerTypMod = targetTypMod;
932 transformContainerType(&containerType, &containerTypMod);
933
934 /* Process subscripts and identify required type for RHS */
935 sbsref = transformContainerSubscripts(pstate,
936 basenode,
937 containerType,
938 containerTypMod,
939 subscripts,
940 true);
941
942 typeNeeded = sbsref->refrestype;
943 typmodNeeded = sbsref->reftypmod;
944
945 /*
946 * Container normally has same collation as its elements, but there's an
947 * exception: we might be subscripting a domain over a container type. In
948 * that case use collation of the base type. (This is shaky for arbitrary
949 * subscripting semantics, but it doesn't matter all that much since we
950 * only use this to label the collation of a possible CaseTestExpr.)
951 */
952 if (containerType == targetTypeId)
953 collationNeeded = targetCollation;
954 else
955 collationNeeded = get_typcollation(containerType);
956
957 /* recurse to create appropriate RHS for container assign */
958 rhs = transformAssignmentIndirection(pstate,
959 NULL,
960 targetName,
961 true,

Callers 1

Calls 10

transformContainerTypeFunction · 0.85
get_typcollationFunction · 0.85
exprTypeFunction · 0.85
coerce_to_target_typeFunction · 0.85
format_type_beFunction · 0.85
parser_errpositionFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected