bug/compatibility-mysql: "information_schema.columns.EXTRA" omits "on update CURRENT_TIMESTAMP"
- Dominant language
- Go
- Stars
- 24.4k
- Forks
- 873
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 120
Description
# `information_schema.columns.EXTRA` omits `on update CURRENT_TIMESTAMP`
## Summary
I have a `TIMESTAMP ... ON UPDATE CURRENT_TIMESTAMP` column. Dolt stores the clause and
applies it correctly at runtime, and `SHOW CREATE TABLE` reports it. But
`information_schema.columns.EXTRA` returns only `DEFAULT_GENERATED`, where MySQL returns
`DEFAULT_GENERATED on update CURRENT_TIMESTAMP`.
Tools (like Drizzle ORM) that introspect schemas through `information_schema` therefore can't see the clause.
## Reproduction
```sql
CREATE TABLE t (
id INT PRIMARY KEY,
n INT,
touched TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
INSERT INTO t (id, n) VALUES (1, 1);
SELECT extra FROM information_schema.columns
WHERE table_name = 't' AND column_name = 'touched';
```
Actual (Dolt 2.3.3):
```
EXTRA
DEFAULT_GENERATED
```
Expected (MySQL 8.4.8, same statements):
```
EXTRA
DEFAULT_GENERATED on update CURRENT_TIMESTAMP
```
## Dolt knows about the clause internally
`SHOW CREATE TABLE t` is correct:
```
`touched` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
```
And the runtime behaviour is correct — the column updates on write:
```sql
SELECT touched FROM t; -- 2026-09-10 13:24:36
-- wait 2s
UPDATE t SET n = 2 WHERE id = 1;
SELECT touched FROM t; -- 2026-09-10 13:24:38 (updated, as expected)
```
So this is only the `information_schema` projection, not storage or execution.
## Why it matters
I hit this with `drizzle-kit pull` (v0.31.10). Its MySQL introspection does a single
substring test on that field (`bin.cjs`):
```js
let columnExtra = column["EXTRA"];
...
if (columnType.startsWith("timestamp") && typeof columnExtra !== "undefined"
&& columnExtra.includes("on update CURRENT_TIMESTAMP")) {
onUpdate = true;
}
```
Pulling from MySQL emits `.onUpdateNow()`; pulling the same database from Dolt omits it.
The generated schema then says the column has no `ON UPDATE`, so a migration generated
from it will drop the clause from the real database. That failure is silent — nothing
errors, timestamps just quietly stop updating.
I pulled the same 112-table database from both servers. The only differences were this
one and `FLOAT(M,D)` precision; everything else matched.
## Environment
- Dolt `2.3.3`, `dolthub/dolt-sql-server:latest`, reports `version()` = `8.0.31`
- Compared against MySQL `8.4.8` (`mysql:8` image)
- Client: `mysql` CLI 8.0.46, Linux (WSL2)
## Suggested fix
Append ` on update CURRENT_TIMESTAMP` to `EXTRA` for columns carrying the clause, matching
MySQL's exact format — uppercase `DEFAULT_GENERATED`, lowercase `on update`, since that is
the string consumers substring-match against.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.