Skip to content

[BUG] MariaDB column defaults are read as MySQL values, so a column with no default shows a default of NULL #795

Description

@cevheri

MariaDB and MySQL disagree about what information_schema.COLUMNS.COLUMN_DEFAULT contains, and the app reads it as though they agree.

MySQL reports a VALUE. MariaDB reports an EXPRESSION. So a nullable MariaDB column declared with no default reports COLUMN_DEFAULT as the four characters NULL, and on MySQL those same four characters mean a column whose default is the literal string NULL. The app shows the user a default nobody wrote.

This is live today through getSchema() on the mysql provider, which serves MariaDB as a wire-compatible variant, so a MariaDB user sees it now.

Measured during #789 by the agent implementing that provider's object surface. It deliberately did not fix it: the same read has two callers, getSchema() and the new describeObject(), and repairing only the new one would leave two live surfaces disagreeing about one column for the rest of that epic. getSchema() is removed at the end of #789, at which point there is one reader and one place to fix.

The fix has a clean route that does not require branching on the database type id: the provider now measures the server version at connect time, so the distinction is available as data.

Two cases still to measure before fixing:

  • What MariaDB reports for a column whose default really is the string NULL.
  • What both engines report for an expression default, for example CURRENT_TIMESTAMP or a generated column.

Done when: a MariaDB column with no default renders as having no default, a MariaDB column defaulting to the literal string NULL renders as that string, and one test pins each against a live server of each family.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions