[ 
https://issues.apache.org/jira/browse/IGNITE-19065?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Iurii Gerzhedovich reassigned IGNITE-19065:
-------------------------------------------

    Assignee: Iurii Gerzhedovich

> Sql. Reject INSERT statements with missing not nullable columns at the 
> validation phase.
> ----------------------------------------------------------------------------------------
>
>                 Key: IGNITE-19065
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19065
>             Project: Ignite
>          Issue Type: Improvement
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Assignee: Iurii Gerzhedovich
>            Priority: Minor
>              Labels: calcite3-required, ignite-3
>             Fix For: 3.0.0-beta2
>
>
> 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:
> {code:java}
>    @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)");
>     }
> {code}
> Error:
> {code:java}
> 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)
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to