Support DOUBLE data types with precision for Mysql (#1611)

This commit is contained in:
artorias1024 2024-12-20 01:11:39 +08:00 committed by GitHub
parent eae5629fb8
commit c973df35d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 21 additions and 9 deletions

View file

@ -254,7 +254,7 @@ pub enum DataType {
/// [postgresql]: https://www.postgresql.org/docs/15/datatype.html
Float8,
/// Double
Double,
Double(ExactNumberInfo),
/// Double PRECISION e.g. [standard], [postgresql]
///
/// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#approximate-numeric-type
@ -508,7 +508,7 @@ impl fmt::Display for DataType {
DataType::Float4 => write!(f, "FLOAT4"),
DataType::Float32 => write!(f, "Float32"),
DataType::Float64 => write!(f, "FLOAT64"),
DataType::Double => write!(f, "DOUBLE"),
DataType::Double(info) => write!(f, "DOUBLE{info}"),
DataType::Float8 => write!(f, "FLOAT8"),
DataType::DoublePrecision => write!(f, "DOUBLE PRECISION"),
DataType::Bool => write!(f, "BOOL"),

View file

@ -8115,7 +8115,9 @@ impl<'a> Parser<'a> {
if self.parse_keyword(Keyword::PRECISION) {
Ok(DataType::DoublePrecision)
} else {
Ok(DataType::Double)
Ok(DataType::Double(
self.parse_exact_number_optional_precision_scale()?,
))
}
}
Keyword::TINYINT => {