[hibernate-dev] MySQL versus MariaDB

Steve Ebersole steve at hibernate.org
Wed Jul 22 15:51:31 EDT 2015


https://hibernate.atlassian.net/browse/HHH-9969

On Wed, Jul 22, 2015 at 2:18 PM Steve Ebersole <steve at hibernate.org> wrote:

> As I have developed the matrix tests against MariaDB I have had in the
> back of my head whether we might want to develop a Dialect for MariaDB.  As
> I understand it, MariaDB does strive to remain compatible with MySQL but it
> does offer some enhancements.  And it might have some minor deviations.
> Today I think I found one such deviation, in their respective support for
> casting decimal/floating-point values.  I came across this because of some
> failed tests.
>
> There are quite a few resolved issues in Jira wrt MySQL and casting.  So I
> have to assume these tests work on MySQL which tells me there is a
> deviation in their behavior...
>
> The tests in question (more or less) do: "select ... cast( x as
> big_decimal ) ...".  We understand big_decimal as java.sql.Types#NUMERIC
> for which the MySQL Dialect says to use "decimal" for casting purposes.
>
> On MariaDB at least "decimal" (no precision) leads to a data trunction.
> We are expecting a value like "12.399999618530273" but get back "12.0".
> Because for MariaDB DECIMAL is equivalent to DECIMAL(10,0).
>
> So as it is, for this minor case at least the MySQL dialects work against
> MySQL databases (we assume) but fail against MariaDB databases.
>
> The other difficulty with a dialect specific for MariaDB is
> auto-detection.  The MariaDB JDBC drivers report the underlying database as
> mysql.
>


More information about the hibernate-dev mailing list