'Is it possible to add values from an array of tuples to separate columns in a table [closed]

I want to insert new rows into a table from a list of tuples in Postgres:

CREATE TABLE my_table(col1 TEXT, col2 INT);

INSERT INTO my_table(col1, col2)
SELECT * FROM UNNEST(ARRAY[('a', 0),('b', 0)]);

But I'm getting the error:

ERROR: a column definition list is required for functions returning "record" LINE 2: SELECT * FROM UNNEST(ARRAY[('a', 0),('b', 0)]);

How can I provide a column definition to that query?

The resulting table should look like this:

col1 | col2
------------
a    | 0
b    | 0


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source