Wrong value and data type of "SELECT MAX(time_column) + 1 FROM t1"

Description

produces this output in MariaDB-5.5 and MariaDB-10.0:

36610000001 is a wrong value. The expected value is 101011.

DECIMAL(11,0) is a wrong type. The expected type is INT(9).

Note, MariaDB-5.3 returns 11 instead of 36610000001, which is also wrong.

Similar problem is observed with a DATETIME column.
This script:

produces this output:

Environment

None

Status

Assignee

Alexander Barkov

Reporter

Alexander Barkov

Labels

None

External issue ID

None

External issue ID

None

Fix versions

Affects versions

Priority

Minor
Configure