Omitting columns in an INSERT statement does not seem to work despite meeting the requirements

fuselessmatt
Contributor

We want to use the INSERT INTO command with specific columns as specified in the official documentation. The only requirements for this are

️ Databricks SQL warehouse version 2022.35 or higher

️ Databricks Runtime 11.2 and above

and the behaviour should be as follows

If this command omits a column, Databricks SQL assigns the corresponding default value instead.

If the target table schema does not define any default value for the inserted column, Databricks SQL assigns NULL if the column is nullable. Otherwise, Databricks SQL raises an error.

We are using SQL Warehouse 2023.15 (> 2022.35) and I guess our Databricks Runtime is on 12.2. Our interpretation of the documentation is therefore that this should work, but it does not. Why does it not work? Historically it did not support Delta-tables, but according to the documentation, that should not be an issue

create table if not exists prod_gold.forecaster.test
(
    col_1      string,
    col_2      string
);
INSERT INTO prod_gold.forecaster.test (col_1) VALUES 
('test')