Merge 'use explicit null if it set instead of column default value' from Nikita Sivukhin

Before, tursodb always used default value even if NULL was explicitly
set by the user

Reviewed-by: Preston Thorpe <preston@turso.tech>

Closes #3422
This commit is contained in:
Preston Thorpe
2025-09-29 11:05:14 -04:00
committed by GitHub
2 changed files with 13 additions and 2 deletions

View File

@@ -1712,7 +1712,9 @@ pub fn op_column(
match serial_type {
// NULL
0 => break 'ifnull,
0 => {
state.registers[*dest] = Register::Value(Value::Null);
}
// I8
1 => {
state.registers[*dest] =

View File

@@ -640,4 +640,13 @@ do_execsql_test_on_specific_db {:memory:} default-values-population {
INSERT INTO t DEFAULT VALUES;
SELECT * FROM t;
} {1|666|
2|666|}
2|666|}
do_execsql_test_on_specific_db {:memory:} set-explicit-null-default-value {
CREATE TABLE t (id INTEGER PRIMARY KEY, x DEFAULT 1);
INSERT INTO t(id, x) VALUES (1, 2);
SELECT * FROM t;
UPDATE t SET x = NULL WHERE id = 1;
SELECT * FROM t;
} {1|2
1|}