I need to write an insert query where one value is an array of 3 elements. I’ve tried to do it like this:
INSERT INTO some_table (id, col) VALUES (1, '{1, 2, 3}');
The sintax I’ve used for ‘col’ value is valid array literal in PostrgreSQL but H2 treats it as a single value of the array but not as an array with 3 elements.
Table DDL:
CREATE TABLE some_table ( id INT PRIMARY KEY , col ARRAY );
Advertisement
Answer
Based on SQL Grammar:
INSERT INTO some_table (id, col) VALUES (1, (1, 2, 3))