-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Description
Schemas containing UUID columns cause an IllegalArgumentException at runtime when generating diff output.
Steps to Reproduce
- Create an empty DDL file and a DDL file with a UUID column:
-- empty.sql -- (empty) -- new.sql CREATE TABLE test (id UUID NOT NULL) PRIMARY KEY (id);
- Run:
java -jar spanner-ddl-diff.jar --originalDdlFile empty.sql --newDdlFile new.sql --outputDdlFile diff.sql - Exception thrown:
Exception in thread "main" java.lang.IllegalArgumentException: Unknown column type UUID at com.google.cloud.solutions.spannerddl.parser.ASTcolumn_type.toString(ASTcolumn_type.java:75)
Root Cause
ASTcolumn_type.java:toString() has a switch statement that handles almost all types such as FLOAT32, INT64, BOOL, etc — but not UUID.
The parser correctly recognizes UUID in ddl_parser.jjt (line 393), so parsing succeeds, but the Java code that converts the AST back to DDL text fails at the switch statement's default branch.
Suggested Fix
Add case "UUID": to the switch in ASTcolumn_type.toString(), falling through to return typeName; (same pattern as other parameterless types like BOOL, DATE).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels