libredb / libredb/libredb-studio
[BUG] MariaDB column defaults are read as MySQL values, so a column with no default shows a default of NULL
- Dominant language
- TypeScript
- Stars
- 726
- Forks
- 119
- Avg merge
- 7h 47m
- Merged PRs (30d)
- 265
Description
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.
Contributor guide
Research direction
Start with the mysql provider's getSchema() and the newer describeObject() path, considering the removal of getSchema() at the end of #789. Measure COLUMN_DEFAULT for missing defaults, literal string NULL defaults, and expression defaults on live MariaDB and MySQL servers, using the provider's recorded server version. Done means tests pin the expected rendering for each engine and the two MariaDB cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mariadb, mysql, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100