Skip to content

fix: deparse casts to single-field row types - #2757

Open
PHJ2000 wants to merge 1 commit into
JSQLParser:masterfrom
PHJ2000:fix-single-field-row-casts
Open

PHJ2000 wants to merge 1 commit into
JSQLParser:masterfrom
PHJ2000:fix-single-field-row-casts

Conversation

@PHJ2000

@PHJ2000 PHJ2000 commented Oct 4, 2026

Copy link
Copy Markdown

SELECT CAST(ROW(1) AS ROW(x BIGINT)) parses successfully, but toString() and StatementDeParser both dereference a null scalar type instead of rendering the one-element row definition.

Treat any nonempty columnDefinitions list as a row target in both serializers. Add a regression that checks the parsed field metadata and independently exercises both serialization paths, plus a TRY_CAST round trip. Existing multi-field and scalar cast coverage remains in the same test class.

Validation: the new regression fails on unmodified master with both NPEs; the same query also fails with the released 5.4 artifact. mvn verify completed the full suite (9,525 tests, 0 failures/errors, 25 skipped), PMD and Checkstyle. The subsequent spotless:check requested import sorting in the two touched production files; mvn spotless:apply spotless:check then passed.

Fixes #2756.

This branch has not been deployed

No deployments
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.

[BUG] JSQLParser 5.4 / 5.5-SNAPSHOT: single-field ROW casts throw NPE when deparsed

1 participant