* helper for transformAssignmentIndirection: process container assignment */
| 902 | * helper for transformAssignmentIndirection: process container assignment |
| 903 | */ |
| 904 | static Node * |
| 905 | transformAssignmentSubscripts(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, |
no test coverage detected