Maksim Zhuravkov created IGNITE-27730:
-----------------------------------------

             Summary: 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
         Environment: 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}

            Reporter: Maksim Zhuravkov






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

Reply via email to