Skip to content

test(ddl): cover generated columns and expression defaults - #1058

Draft
aparajon wants to merge 1 commit into
mainfrom
armand/ddl-canonicalization-tests
Draft

test(ddl): cover generated columns and expression defaults#1058
aparajon wants to merge 1 commit into
mainfrom
armand/ddl-canonicalization-tests

Conversation

@aparajon

Copy link
Copy Markdown
Collaborator

Follow-up to the Spirit bump. The differ had no coverage for the two column shapes MySQL reports back with parentheses of its own — generated columns and parenthesized DEFAULT expressions — which is exactly the area the new parser touched.

The tests pin that both are compared as parsed expressions rather than as text, so a converged table plans no work whichever spelling its schema file uses, while a changed expression, a STORED/VIRTUAL switch, and an expression default that is not DEFAULT CURRENT_TIMESTAMP each still plan an ALTER. The source-side fixture is verbatim SHOW CREATE TABLE output from MySQL 8.0, so the round trip is the real one a plan performs and not an idealized form.

Two behavior differences the coverage records, both improvements:

  • A DEFAULT expression wrapped in nested parentheses now parses. It used to be rejected outright, even though MySQL emits that form itself, which made any table using one unplannable.
  • DEFAULT (now()) and DEFAULT CURRENT_TIMESTAMP are now distinguished. MySQL reports each back exactly as declared, so collapsing them let a schema file drift from its table with no plan ever showing it.

Based on the Spirit bump branch rather than main, since the behavior only holds with the newer parser.

This PR was written by Claude Code (claude-opus-5).

Base automatically changed from armand/bump-spirit to main August 17, 2026 03:39
The differ had no coverage for the two column shapes MySQL reports back with
parentheses of its own: generated columns and parenthesized DEFAULT
expressions. Both are compared as parsed expressions rather than text, so a
converged table plans no work whichever spelling the schema file uses, while a
changed expression, a STORED/VIRTUAL switch, and an expression default that is
not DEFAULT CURRENT_TIMESTAMP each still plan an ALTER.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@aparajon
aparajon force-pushed the armand/ddl-canonicalization-tests branch from 9f08ffc to 0cf1fcb Compare August 17, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant