22.11. Creating MAP Data from Key-Value Pairs (map_from_entries) #
This stored procedure must be executed inside a duckdb.query() call as Postgres Pro AXE does not support the MAP data type.
Required privileges: Postgres Pro AXE administrator only. For a full list of stored procedures and privileges, refer to Section 12.1.
Execute the following command on the Postgres Pro AXE server:
SELECT * FROM duckdb.query('SELECT map_from_entries(STRUCT[, STRUCT ...])') ON CONFLICT DO NOTHING;
Where STRUCT are the values with the k and v fields that represent key-value pairs.
Postgres Pro AXE returns the MAP data created from the specified key-value pairs.
Example 22.11. Executing the map_from_entries Stored Procedure
SELECT * FROM duckdb.query('SELECT map_from_entries([{k: 5, v: ''val1''}, {k: 3, v: ''val2''}])') ON CONFLICT DO NOTHING;
{5=val1, 3=val2}