PrimeIntellect/SWE-rebench-V2 huggingface dataset:
Repository: gluesql/gluesql (rust)

Issue:
Cannot insert null to nullable text type field
![image](https://user-images.githubusercontent.com/2025065/91076413-6ef26780-e67a-11ea-9f01-cf2010f3c39a.png)

In `src/data/value.rs`,
![image](https://user-images.githubusercontent.com/2025065/91076423-74e84880-e67a-11ea-856d-242163093608.png)

current `from_data_type` function is not handling String type, unit test required

Pull request:
Fix Value to handle Null -> OptStr(None) case (#38)
resolve #38 

Patch:
diff --git a/src/data/value.rs b/src/data/value.rs
index ea65e8fe..6155f42b 100644
--- a/src/data/value.rs
+++ b/src/data/value.rs
@@ -200,6 +200,10 @@ impl Value {
                 Value::OptBool(None),
                 ValueError::NullValueOnNotNullField.into(),
             ),
+            (DataType::Text, AstValue::Null) => nullable.as_result(
+                Value::OptStr(None),
+                ValueError::NullValueOnNotNullField.into(),
+            ),
             _ => Err(ValueError::SqlTypeNotSupported.into()),
         }
     }


Test patch:
diff --git a/src/tests/mod.rs b/src/tests/mod.rs
index a5518c5e..f94afa3c 100644
--- a/src/tests/mod.rs
+++ b/src/tests/mod.rs
@@ -44,6 +44,7 @@ macro_rules! generate_tests {
         glue!(migrate, migrate::migrate);
         glue!(nested_select, nested_select::nested_select);
         glue!(nullable, nullable::nullable);
+        glue!(nullable_text, nullable::nullable_text);
         glue!(ordering, ordering::ordering);
         glue!(sql_types, sql_types::sql_types);
         glue!(synthesize, synthesize::synthesize);
diff --git a/src/tests/nullable.rs b/src/tests/nullable.rs
index eae6ac67..d959cc13 100644
--- a/src/tests/nullable.rs
+++ b/src/tests/nullable.rs
@@ -46,3 +46,23 @@ CREATE TABLE Test (
     let expected = Err(ValueError::NullValueOnNotNullField.into());
     assert_eq!(expected, found);
 }
+
+pub fn nullable_text(mut tester: impl tests::Tester) {
+    tester.run_and_print(
+        "
+        CREATE TABLE Foo (
+            id INTEGER,
+            name TEXT NULL
+        );
+    ",
+    );
+
+    let insert_sqls = [
+        "INSERT INTO Foo (id, name) VALUES (1, \"Hello\")",
+        "INSERT INTO Foo (id, name) VALUES (2, Null)",
+    ];
+
+    for insert_sql in insert_sqls.iter() {
+        tester.run(insert_sql).unwrap();
+    }
+}