I have a table defined as:
CREATE TABLE IF NOT EXISTS test (
id INT NOT NULL,
depth_mm REAL[]
);
If I insert something with both numbers and null values in the depth_mm array, there is no problem:
INSERT INTO test (id, depth_mm) VALUES (2, ARRAY[1,NULL,NULL]);
But if I insert an array of values, it complains:
INSERT INTO test (id, depth_mm) VALUES (2, ARRAY[NULL,NULL,NULL]);
ERROR: column "depth_mm" is of type real[] but expression is of type text[]
LINE 1: INSERT INTO test (id, depth_mm) VALUES (2, ARRAY[NULL,NULL,NU...
^
HINT: You will need to rewrite or cast the expression.
How do I get Postgres to understand that I want to insert an array of null values?