=========================== Map Functions and Operators =========================== Subscript Operator: [] ---------------------- The ``[]`` operator is used to retrieve the value corresponding to a given key from a map:: SELECT name_to_age_map['Bob'] AS bob_age; Map Functions ------------- .. function:: cardinality(x) -> bigint :noindex: Returns the cardinality (size) of the map ``x``. .. function:: element_at(map, key) -> V :noindex: Returns value for given ``key``, or ``NULL`` if the key is not contained in the map. .. function:: map(array, array) -> map Returns a map created using the given key/value arrays. :: none SELECT map(ARRAY[1,3], ARRAY[2,4]); -- {1 -> 2, 3 -> 4} See also :func:`map_agg` and :func:`multimap_agg` for creating a map as an aggregation. .. function:: map_concat(x, y) -> map Returns the union of two maps. If a key is found in both ``x`` and ``y``, that key's value in the resulting map comes from ``y``. .. function:: map_keys(x) -> array Returns all the keys in the map ``x``. .. function:: map_values(x) -> array Returns all the values in the map ``x``.