You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Maksim Zhuravkov (Jira)" <ji...@apache.org> on 2024/04/09 13:03:00 UTC

[jira] [Updated] (IGNITE-22015) Sql. NOT NULL constraint is ignored by UPDATE statement

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

Maksim Zhuravkov updated IGNITE-22015:
--------------------------------------
    Labels: ignite-3  (was: )

> Sql. NOT NULL constraint is ignored by UPDATE statement
> -------------------------------------------------------
>
>                 Key: IGNITE-22015
>                 URL: https://issues.apache.org/jira/browse/IGNITE-22015
>             Project: Ignite
>          Issue Type: Bug
>          Components: sql
>            Reporter: Maksim Zhuravkov
>            Priority: Major
>              Labels: ignite-3
>
> NOT NULL constraint is ignored by UPDATE statement and it is possible to set null value to not null column.
> {code:java}
>  @Test
> public void test() {
>     sql("CREATE TABLE t (id INTEGER PRIMARY KEY, int_col INTEGER NOT NULL)");
>     try {
>         sql("INSERT INTO t VALUES(1, NULL)");
>         fail();
>     } catch (Exception e) {
>         System.err.println(e.getMessage());// Column 'INT_COL' does not allow NULLs
>     }
>     sql("INSERT INTO t VALUES(1, 42)");
>     sql("UPDATE t SET int_col = NULL");
>     
>     for (var row : sql("SELECT id, int_col FROM t")) {
>         System.err.println(row);
>     }
> }
> {code}



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