4 tests are failing

This commit is contained in:
filipriec
2025-06-22 22:15:08 +02:00
parent 1b1e7b7205
commit 7403b3c3f8
2 changed files with 5 additions and 2 deletions

View File

@@ -13,6 +13,9 @@ const PREDEFINED_FIELD_TYPES: &[(&str, &str)] = &[
("time", "TIMESTAMPTZ"), ("time", "TIMESTAMPTZ"),
("money", "NUMERIC(14, 4)"), ("money", "NUMERIC(14, 4)"),
("integer", "INTEGER"), ("integer", "INTEGER"),
("int", "INTEGER"),
("biginteger", "BIGINT"),
("bigint", "BIGINT"),
("date", "DATE"), ("date", "DATE"),
]; ];

View File

@@ -182,7 +182,7 @@ pub async fn post_table_data(
"BOOLEAN" => params.add(None::<bool>), "BOOLEAN" => params.add(None::<bool>),
"TEXT" => params.add(None::<String>), "TEXT" => params.add(None::<String>),
"TIMESTAMPTZ" => params.add(None::<DateTime<Utc>>), "TIMESTAMPTZ" => params.add(None::<DateTime<Utc>>),
"BIGINT" => params.add(None::<i64>), "BIGINT" | "INTEGER" => params.add(None::<i64>),
s if s.starts_with("NUMERIC") => params.add(None::<Decimal>), s if s.starts_with("NUMERIC") => params.add(None::<Decimal>),
_ => return Err(Status::invalid_argument(format!("Unsupported type for null value: {}", sql_type))), _ => return Err(Status::invalid_argument(format!("Unsupported type for null value: {}", sql_type))),
}.map_err(|e| Status::internal(format!("Failed to add null parameter for {}: {}", col, e)))?; }.map_err(|e| Status::internal(format!("Failed to add null parameter for {}: {}", col, e)))?;
@@ -223,7 +223,7 @@ pub async fn post_table_data(
} else { } else {
return Err(Status::invalid_argument(format!("Expected ISO 8601 string for column '{}'", col))); return Err(Status::invalid_argument(format!("Expected ISO 8601 string for column '{}'", col)));
} }
} else if sql_type == "BIGINT" { } else if sql_type == "BIGINT" || sql_type == "INTEGER" {
if let Kind::NumberValue(val) = kind { if let Kind::NumberValue(val) = kind {
if val.fract() != 0.0 { if val.fract() != 0.0 {
return Err(Status::invalid_argument(format!("Expected integer for column '{}', but got a float", col))); return Err(Status::invalid_argument(format!("Expected integer for column '{}', but got a float", col)));