MAP_INSERT
Returns a new MAP consisting of the input MAP with a new key-value pair inserted (an existing key updated with a new value).
Syntax
MAP_INSERT( <map>, <key>, <value> [, <updateFlag> ] )
Arguments
Return Type
Map.
Examples
SELECT MAP_INSERT({'a':1,'b':2,'c':3}, 'd', 4);
┌─────────────────────────────────────────┐
│ map_insert({'a':1,'b':2,'c':3}, 'd', 4) │
├─────────────────────────────────────────┤
│ {'a':1,'b':2,'c':3,'d':4} │
└─────────────────────────────────────────┘
SELECT MAP_INSERT({'a':1,'b':2,'c':3}, 'a', 5, true);
┌───────────────────────────────────────────────┐
│ map_insert({'a':1,'b':2,'c':3}, 'a', 5, TRUE) │
├───────────────────────────────────────────────┤
│ {'a':5,'b':2,'c':3} │
└───────────────────────────────────────────────┘