Explicit cast between element types

When a conversion between different element types of two collections is performed with an explicit cast, you must explicitly cast one collection to the other collection type. In the following example, the conversion between the element types (INT and my_int) requires an explicit cast. (A cast between a distinct type and its source type is always explicit).

The following INSERT statement retrieves elements from the set_tab2 table and inserts the elements into the set_tab1 table. The collection column from set_tab2 has an INT element type, and the collection column from set_tab1 has a my_int element type. Because the conversion between the element types (INT and my_int) requires an explicit cast, you must explicitly cast the collection type.
INSERT INTO set_tab1 SELECT col2::SET(my_int NOT NULL) 
   FROM set_tab2

To perform an explicit cast on a collection type, you must include the constructor (SET, MULTISET, or LIST), the element type, and the NOT NULL keyword.