[
https://issues.apache.org/jira/browse/IGNITE-22015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksim Zhuravkov updated IGNITE-22015:
--------------------------------------
Description:
NOT NULL constraint is ignored by UPDATE statement and it is possible to set
null value to a 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}
was:
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}
> 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 a 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)