[
https://issues.apache.org/jira/browse/IGNITE-27730?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maksim Zhuravkov updated IGNITE-27730:
--------------------------------------
Description:
It is not possible to read a row from a table after adding a NOT NULL column to
that table.
{noformat}
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.sql.IgniteSql;
public class Repoducer {
public static void main(String[] args) {
try (var client = IgniteClient.builder()
.addresses("localhost:10801")
.build()
) {
IgniteSql sql = client.sql();
try (var rs = sql.execute(null, "DROP TABLE IF EXISTS kv")) {
System.err.println(rs.affectedRows());
}
try (var rs = sql.execute(null, "CREATE TABLE kv (key INT, val INT,
PRIMARY KEY (key) )")) {
System.err.println(rs.affectedRows());
}
// Insert
try (var rs = sql.execute(null, "INSERT INTO kv VALUES(1, 1)")) {
System.err.println(rs.affectedRows());
}
// Select
try (var rs = sql.execute(null, "SELECT * FROM kv")) {
while (rs.hasNext()) {
System.err.println(rs.next());
}
}
// Add not null column
try (var rs = sql.execute(null, "ALTER TABLE kv ADD COLUMN ts
TIMESTAMP NOT NULL")) {
System.err.println(rs.affectedRows());
}
// What's there?
try (var rs = sql.execute(null, "SELECT * FROM kv")) {
while (rs.hasNext()) {
System.err.println(rs.next());
}
}
}
}
}
{noformat}
Error:
{noformat}
Exception in thread "main" org.apache.ignite.sql.SqlException: IGN-CMN-65535
NULL value for non-nullable column in binary tuple builder. TraceId:8dfe9ba3
at
java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
at
org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:944)
at
org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:878)
at
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:680)
at
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:813)
at
org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:632)
at
org.apache.ignite.internal.client.sql.ClientSql.execute(ClientSql.java:147)
at org.apache.ignite.sql.IgniteSql.execute(IgniteSql.java:49)
at Repoducer.main(Repoducer.java:38)
{noformat}
was:
It is not possible to read a row from a table after adding a NOT NULL column to
that table.
{noformat}
import org.apache.ignite.client.IgniteClient;
import org.apache.ignite.sql.IgniteSql;
public class Repoducer {
public static void main(String[] args) {
try (var client = IgniteClient.builder()
.addresses("localhost:10801")
.build()
) {
IgniteSql sql = client.sql();
try (var rs = sql.execute(null, "DROP TABLE IF EXISTS kv")) {
System.err.println(rs.affectedRows());
}
try (var rs = sql.execute(null, "CREATE TABLE kv (key INT, val INT,
PRIMARY KEY (key) )")) {
System.err.println(rs.affectedRows());
}
// Insert
try (var rs = sql.execute(null, "INSERT INTO kv VALUES(1, 1)")) {
System.err.println(rs.affectedRows());
}
// Select
try (var rs = sql.execute(null, "SELECT * FROM kv")) {
while (rs.hasNext()) {
System.err.println(rs.next());
}
}
// Add not null column
try (var rs = sql.execute(null, "ALTER TABLE kv ADD COLUMN ts
TIMESTAMP NOT NULL")) {
System.err.println(rs.affectedRows());
}
// What's there?
try (var rs = sql.execute(null, "SELECT * FROM kv")) {
while (rs.hasNext()) {
System.err.println(rs.next());
}
}
}
}
}
{noformat}
> Sql. NULL value for non-nullable column in binary tuple builder.
> ----------------------------------------------------------------
>
> Key: IGNITE-27730
> URL: https://issues.apache.org/jira/browse/IGNITE-27730
> Project: Ignite
> Issue Type: Bug
> Components: sql ai3
> Affects Versions: 3.1
> Reporter: Maksim Zhuravkov
> Priority: Major
> Labels: ignite-3
>
> It is not possible to read a row from a table after adding a NOT NULL column
> to that table.
> {noformat}
> import org.apache.ignite.client.IgniteClient;
> import org.apache.ignite.sql.IgniteSql;
> public class Repoducer {
> public static void main(String[] args) {
> try (var client = IgniteClient.builder()
> .addresses("localhost:10801")
> .build()
> ) {
> IgniteSql sql = client.sql();
> try (var rs = sql.execute(null, "DROP TABLE IF EXISTS kv")) {
> System.err.println(rs.affectedRows());
> }
>
> try (var rs = sql.execute(null, "CREATE TABLE kv (key INT, val
> INT, PRIMARY KEY (key) )")) {
> System.err.println(rs.affectedRows());
> }
>
> // Insert
> try (var rs = sql.execute(null, "INSERT INTO kv VALUES(1, 1)")) {
> System.err.println(rs.affectedRows());
> }
>
> // Select
> try (var rs = sql.execute(null, "SELECT * FROM kv")) {
> while (rs.hasNext()) {
> System.err.println(rs.next());
> }
> }
>
> // Add not null column
> try (var rs = sql.execute(null, "ALTER TABLE kv ADD COLUMN ts
> TIMESTAMP NOT NULL")) {
> System.err.println(rs.affectedRows());
> }
> // What's there?
> try (var rs = sql.execute(null, "SELECT * FROM kv")) {
> while (rs.hasNext()) {
> System.err.println(rs.next());
> }
> }
> }
> }
> }
> {noformat}
> Error:
> {noformat}
> Exception in thread "main" org.apache.ignite.sql.SqlException: IGN-CMN-65535
> NULL value for non-nullable column in binary tuple builder. TraceId:8dfe9ba3
> at
> java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
> at
> org.apache.ignite.internal.util.ExceptionUtils$1.copy(ExceptionUtils.java:944)
> at
> org.apache.ignite.internal.util.ExceptionUtils$ExceptionFactory.createCopy(ExceptionUtils.java:878)
> at
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:680)
> at
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCauseInternal(ExceptionUtils.java:813)
> at
> org.apache.ignite.internal.util.ExceptionUtils.copyExceptionWithCause(ExceptionUtils.java:632)
> at
> org.apache.ignite.internal.client.sql.ClientSql.execute(ClientSql.java:147)
> at org.apache.ignite.sql.IgniteSql.execute(IgniteSql.java:49)
> at Repoducer.main(Repoducer.java:38)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)