Skip to main content
MAP(K, V) stores key-value pairs. Here’s what K and V represent:
  • K: The type of the Map keys. It can be string or integral types (i.e., character varying, smallint, integer, or bigint). It must not be NULL, and must be unique in the map.
  • V: The type of the Map values. It can be arbitrary type.

Define a map

To create a map with VARCHAR keys and INTEGER values, use the statement below.
Alternatively, it can be constructed from two arrays with map_from_key_values or from an array of key-value pairs with map_from_entries.
The following statement defines a table x that has a MAP(VARCHAR, INTEGER) column.

Access data in a map

Use bracket notation to access the value of a key.

Modify data in a map

Use map_insert to insert or overwrite a key-value pair into a map.

Map functions and operators

For the full list of map functions and operators, see Map functions and operators.