Correctness Update

SQL
3 min read

Welcome to another edition of Dolt's monthly correctness updates! If you missed it, here's last month's update. This month, we resolved customer issues with ORMs, tackled older date and time bugs, and dealt with a long standing auto increment issue. We did all this with me being on vacation for most of the month. Thank you team.

Prisma

Prisma ORM is a popular tool for interacting with databases, specifically through Node.js and Typescript. You can read more about using Prisma with Dolt in our blog post.

Recently, a customer reported an issue when trying to migrate a dolt repository with Prisma. The migration would fail with the error Error: unknown error: can not prepare multiple statements. It turned out that Dolt's parser was not properly handling newline characters after semicolons in SQL statements. This was a simple fix, so we patched it and released a new version of Dolt for the customer.

Subsequently, they discovered another issue where a Prisma migration would indicate schema changes, despite no changes being made. Rather than SHOW CREATE TABLE statements, Prisma was using the INFORMATION_SCHEMA.COLUMNS table to determine schema changes. The schema changes were always datetime columns, and upon investigation, we found that we were not properly displaying DATETIME_PRECISION column in INFORMATION_SCHEMA.COLUMNS. 2 hours later, we merged in a fix and released a new version of Dolt later that day.

As always, we prioritize customer issues and are capable of quick turn arounds for many issues.

Older Issues

This month, we found some time to address a few of the more minor bugs in our backlog of issues.

Date Display

We logged an issue earlier this year, where DATE results from DATE_ADD(), DATE_SUB(), ADDDATE(), SUBDATE() would include the time component. Although the result isn't incorrect and is still usable, it did not match MySQL's behavior.

While fixing this issue, we came across some interesting behavior in MySQL. MySQL's precision rules for these outputs is different depending on the input type:

mysql> select adddate('2000-01-02', interval 100 microsecond);
+-------------------------------------------------+
| adddate('2000-01-02', interval 100 microsecond) |
+-------------------------------------------------+
| 2000-01-02 00:00:00.000100                      |
+-------------------------------------------------+
1 row in set (0.0004 sec)

mysql> select adddate(date('2000-01-02'), interval 100 microsecond);
+-------------------------------------------------------+
| adddate(date('2000-01-02'), interval 100 microsecond) |
+-------------------------------------------------------+
| 2000-01-02 00:00:00.0001                              |
+-------------------------------------------------------+
1 row in set (0.0005 sec)

We care about compatibility, so Dolt does this as well.

Auto Increment and InsertID

Whenever a row is inserted into a table with an auto increment column and a value has to be generated for that column, MySQL will set the LAST_INSERT_ID() to the generated value. This also happens when the value is explicitly set to NULL or DEFAULT.

We've known about this issue for a while, but it was a low priority. The fix actually led to the discovery an issue in the InsertID field of our OkResult structs, which was broken in a similar way.

Both of these have been resolved, and we've added tests to ensure that they don't regress.

Metrics Summary

Since last time, we've increase the total number of enginetests from 43578 to 43825. None of the new tests are skipped tests, so the total number of skipped tests remains at 218. This yields a 99.50 percent pass rate.

Demand for the missing MySQL functions has been low so our attention has been around customer issues, so there haven't been any new functions added to Dolt. However, the docs were incorrectly listing a few internal-use-only MySQL functions, so we removed them from the docs. This means that we support 308 out of 438, netting 71 percent coverage.

Conclusion

It's vacation season, and many members of the team (including myself) have been away. Regardless, Dolt is always improving; we're dedicated to squashing customer bugs in a timely manner. If you have any features or bugs you want us to prioritize, please make an issue on our Github Issues page. Feel free to join our Discord and chat with the team and other Dolt users.

SHARE

JOIN THE DATA EVOLUTION

Get started with Dolt

Or join our mailing list to get product updates.