Details
-
Improvement
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
Docs Required, Release Notes Required
Description
INSERT queries with missing columns that have NOT NULL constraint successfully pass the validation phase and fail at the execution phase because that constraint is violated.
It would be better to reject INSERT statements with omitted not nullable columns at the validation phase in order not execute queries that always fail.
An example of the current behaviour:
@Test public void test() { sql("CREATE TABLE integers(i INTEGER, j INTEGER NOT NULL, k INTEGER)"); sql("INSERT INTO integers (i, k) VALUES (1, 0)"); }
Error:
Caused by: org.apache.ignite.internal.schema.SchemaMismatchException: IGN-CMN-65535 TraceId:73ff8353-de43-4a58-9332-9f7d87718a93 Failed to set column (null was passed, but column is not nullable): Column [schemaIndex=1, columnOrder=1, name=J, type=NativeType [name=INT32, sizeInBytes=4, fixed=true], nullable=false] at org.apache.ignite.internal.schema.row.RowAssembler.appendNull(RowAssembler.java:261) at org.apache.ignite.internal.schema.row.RowAssembler.writeValue(RowAssembler.java:112) at org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl.convertRow(IgniteTableImpl.java:516) at org.apache.ignite.internal.sql.engine.schema.IgniteTableImpl.insertAll(IgniteTableImpl.java:390)