FabianTe
FabianTe

Reputation: 649

MariaDB default float can't contain decimal places

I am learning about MariaDBs column types and noticed this on my MariaDB db (latest dockerized 10.3.13), connected via HeidiSQL 10.

I can't set the default value for my FLOAT column to a value that contains decimal places:

enter image description here

After hitting save the default value is just 42. This also happens when performing the ALTER / CREATE TABLE query manually. (In the screenshot the column type is FLOAT but I also tested with FLOAT(10,2).)

Edit: When creating the table with this SQL statement, new rows will have the default value 42 instead of 42.11:

CREATE TABLE test2 (
    `float` FLOAT(10,2) NOT NULL DEFAULT '42.11'
)

Why?

Upvotes: 1

Views: 2511

Answers (1)

Diego Dupin
Diego Dupin

Reputation: 1348

I've just reported that to HeidiSQL, This is only a display bug on HeidiSQL: https://github.com/HeidiSQL/HeidiSQL/issues/593

You can execute "SHOW CREATE TABLE test2" or insert data into test2, this will show you that default value is not truncated.

Upvotes: 1

Related Questions