@@ -131,6 +131,11 @@ pub enum DataType {
131131 ///
132132 /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type
133133 Decimal ( ExactNumberInfo ) ,
134+ /// [MySQL] unsigned decimal with optional precision and scale, e.g. DECIMAL UNSIGNED or DECIMAL(10,2) UNSIGNED.
135+ /// Note: Using UNSIGNED with DECIMAL is deprecated in recent versions of MySQL.
136+ ///
137+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html
138+ DecimalUnsigned ( ExactNumberInfo ) ,
134139 /// [BigNumeric] type used in BigQuery.
135140 ///
136141 /// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals
@@ -143,8 +148,19 @@ pub enum DataType {
143148 ///
144149 /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type
145150 Dec ( ExactNumberInfo ) ,
146- /// Floating point with optional precision, e.g. FLOAT(8).
147- Float ( Option < u64 > ) ,
151+ /// [MySQL] unsigned decimal (DEC alias) with optional precision and scale, e.g. DEC UNSIGNED or DEC(10,2) UNSIGNED.
152+ /// Note: Using UNSIGNED with DEC is deprecated in recent versions of MySQL.
153+ ///
154+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html
155+ DecUnsigned ( ExactNumberInfo ) ,
156+ /// Floating point with optional precision and scale, e.g. FLOAT, FLOAT(8), or FLOAT(8,2).
157+ Float ( ExactNumberInfo ) ,
158+ /// [MySQL] unsigned floating point with optional precision and scale, e.g.
159+ /// FLOAT UNSIGNED, FLOAT(10) UNSIGNED or FLOAT(10,2) UNSIGNED.
160+ /// Note: Using UNSIGNED with FLOAT is deprecated in recent versions of MySQL.
161+ ///
162+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html
163+ FloatUnsigned ( ExactNumberInfo ) ,
148164 /// Tiny integer with optional display width, e.g. TINYINT or TINYINT(3).
149165 TinyInt ( Option < u64 > ) ,
150166 /// Unsigned tiny integer with optional display width,
@@ -302,17 +318,32 @@ pub enum DataType {
302318 Float64 ,
303319 /// Floating point, e.g. REAL.
304320 Real ,
321+ /// [MySQL] unsigned real, e.g. REAL UNSIGNED.
322+ /// Note: Using UNSIGNED with REAL is deprecated in recent versions of MySQL.
323+ ///
324+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html
325+ RealUnsigned ,
305326 /// Float8 is an alias for Double in [PostgreSQL].
306327 ///
307328 /// [PostgreSQL]: https://www.postgresql.org/docs/current/datatype.html
308329 Float8 ,
309330 /// Double
310331 Double ( ExactNumberInfo ) ,
332+ /// [MySQL] unsigned double precision with optional precision, e.g. DOUBLE UNSIGNED or DOUBLE(10,2) UNSIGNED.
333+ /// Note: Using UNSIGNED with DOUBLE is deprecated in recent versions of MySQL.
334+ ///
335+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html
336+ DoubleUnsigned ( ExactNumberInfo ) ,
311337 /// Double Precision, see [SQL Standard], [PostgreSQL].
312338 ///
313339 /// [SQL Standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#approximate-numeric-type
314340 /// [PostgreSQL]: https://www.postgresql.org/docs/current/datatype-numeric.html
315341 DoublePrecision ,
342+ /// [MySQL] unsigned double precision, e.g. DOUBLE PRECISION UNSIGNED.
343+ /// Note: Using UNSIGNED with DOUBLE PRECISION is deprecated in recent versions of MySQL.
344+ ///
345+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/numeric-type-syntax.html
346+ DoublePrecisionUnsigned ,
316347 /// Bool is an alias for Boolean, see [PostgreSQL].
317348 ///
318349 /// [PostgreSQL]: https://www.postgresql.org/docs/current/datatype.html
@@ -497,12 +528,19 @@ impl fmt::Display for DataType {
497528 DataType :: Decimal ( info) => {
498529 write ! ( f, "DECIMAL{info}" )
499530 }
531+ DataType :: DecimalUnsigned ( info) => {
532+ write ! ( f, "DECIMAL{info} UNSIGNED" )
533+ }
500534 DataType :: Dec ( info) => {
501535 write ! ( f, "DEC{info}" )
502536 }
537+ DataType :: DecUnsigned ( info) => {
538+ write ! ( f, "DEC{info} UNSIGNED" )
539+ }
503540 DataType :: BigNumeric ( info) => write ! ( f, "BIGNUMERIC{info}" ) ,
504541 DataType :: BigDecimal ( info) => write ! ( f, "BIGDECIMAL{info}" ) ,
505- DataType :: Float ( size) => format_type_with_optional_length ( f, "FLOAT" , size, false ) ,
542+ DataType :: Float ( info) => write ! ( f, "FLOAT{info}" ) ,
543+ DataType :: FloatUnsigned ( info) => write ! ( f, "FLOAT{info} UNSIGNED" ) ,
506544 DataType :: TinyInt ( zerofill) => {
507545 format_type_with_optional_length ( f, "TINYINT" , zerofill, false )
508546 }
@@ -616,12 +654,15 @@ impl fmt::Display for DataType {
616654 write ! ( f, "UNSIGNED INTEGER" )
617655 }
618656 DataType :: Real => write ! ( f, "REAL" ) ,
657+ DataType :: RealUnsigned => write ! ( f, "REAL UNSIGNED" ) ,
619658 DataType :: Float4 => write ! ( f, "FLOAT4" ) ,
620659 DataType :: Float32 => write ! ( f, "Float32" ) ,
621660 DataType :: Float64 => write ! ( f, "FLOAT64" ) ,
622661 DataType :: Double ( info) => write ! ( f, "DOUBLE{info}" ) ,
662+ DataType :: DoubleUnsigned ( info) => write ! ( f, "DOUBLE{info} UNSIGNED" ) ,
623663 DataType :: Float8 => write ! ( f, "FLOAT8" ) ,
624664 DataType :: DoublePrecision => write ! ( f, "DOUBLE PRECISION" ) ,
665+ DataType :: DoublePrecisionUnsigned => write ! ( f, "DOUBLE PRECISION UNSIGNED" ) ,
625666 DataType :: Bool => write ! ( f, "BOOL" ) ,
626667 DataType :: Boolean => write ! ( f, "BOOLEAN" ) ,
627668 DataType :: Date => write ! ( f, "DATE" ) ,
0 commit comments