Title: [BUG] JSQLParser 5.4 / 5.5-SNAPSHOT: single-field ROW casts throw NPE when deparsed · Issue #2756 · JSQLParser/JSqlParser · GitHub
Open Graph Title: [BUG] JSQLParser 5.4 / 5.5-SNAPSHOT: single-field ROW casts throw NPE when deparsed · Issue #2756 · JSQLParser/JSqlParser
X Title: [BUG] JSQLParser 5.4 / 5.5-SNAPSHOT: single-field ROW casts throw NPE when deparsed · Issue #2756 · JSQLParser/JSqlParser
Description: Failing SQL Feature A cast to a named ROW with one field parses successfully, but both Statement.toString() and StatementDeParser throw NullPointerException. This prevents applications from serializing or rewriting the parsed query. SQL ...
Open Graph Description: Failing SQL Feature A cast to a named ROW with one field parses successfully, but both Statement.toString() and StatementDeParser throw NullPointerException. This prevents applications from seriali...
X Description: Failing SQL Feature A cast to a named ROW with one field parses successfully, but both Statement.toString() and StatementDeParser throw NullPointerException. This prevents applications from seriali...
Opengraph URL: https://github.com/JSQLParser/JSqlParser/issues/2756
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[BUG] JSQLParser 5.4 / 5.5-SNAPSHOT: single-field ROW casts throw NPE when deparsed","articleBody":"### Failing SQL Feature\n\nA cast to a named `ROW` with one field parses successfully, but both `Statement.toString()` and `StatementDeParser` throw `NullPointerException`. This prevents applications from serializing or rewriting the parsed query.\n\n### SQL Example\n\n```sql\nSELECT CAST(ROW(1) AS ROW(x BIGINT))\n```\n\nMinimal Java reproduction (run each serialization call separately):\n\n```java\nStatement statement = CCJSqlParserUtil.parse(\n \"SELECT CAST(ROW(1) AS ROW(x BIGINT))\");\nSystem.out.println(statement.toString());\n\nStringBuilder output = new StringBuilder();\nstatement.accept(new StatementDeParser(output));\n```\n\nExpected: both paths preserve the query, including `ROW(x BIGINT)`.\n\nActual: the first throws from `CastExpression.toString()`, and the second throws from `ExpressionDeParser.visit(CastExpression, ...)`, because `colDataType` is null. The parser correctly stores the target in a one-element `columnDefinitions` list, but both serializers require its size to be greater than one before rendering it as a row type.\n\n### Software Information\n\n- Reproduced with the Maven Central `com.github.jsqlparser:jsqlparser:5.4` artifact.\n- Also reproduced on current master `26d3e02a78e061f5fecf2eb2e783bf0482e10840` (`5.5-SNAPSHOT`).\n- Java 21.\n- SQL dialect: Trino. Its [ROW documentation](https://trino.io/docs/current/language/types.html#row) describes named row fields; the [type grammar](https://github.com/trinodb/trino/blob/07fe2c468e391dd178ce20f0797fe239eb03951f/core/trino-grammar/src/main/antlr4/io/trino/grammar/sql/SqlBase.g4) permits one field: `ROW '(' rowField (',' rowField)* ')'`.\n\nThe [online formatter](http://jsqlformatter.manticore-projects.com) also returns `-- failed to format start` around this query.\n\nThe earlier #1267 / #1274 added support for casting to multi-field row types. This report concerns the remaining single-field serialization case.\n","author":{"url":"https://github.com/PHJ2000","@type":"Person","name":"PHJ2000"},"datePublished":"2026-10-04T17:04:59Z","url":"https://github.com/JSQLParser/JSqlParser/issues/2756"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:366df931-230e-d986-1e87-1ce676b6aeca |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D822:3A7F2:596164:78632E:6AFBC7F4 |
| html-safe-nonce | 98d9b027cf2d7b736aec9f9eef9251b68b98f46f3903feeff2febdcee81faac5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEODIyOjNBN0YyOjU5NjE2NDo3ODYzMkU6NkFGQkM3RjQiLCJ2aXNpdG9yX2lkIjoiODUyMjg3NDUyMDYyMzM2ODE4MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | cdc52f908992431a5428cd9ba7ec5518fd94ab6279706b5878e153caa05e5495 |
| hovercard-subject-tag | issue:5701433977 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JSQLParser/JSqlParser/2756/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4da0e2c252c4fb3a4003c39b63b1f75cab8c2063df72d85d6a8a75619b25d803/JSQLParser/JSqlParser/issues/2756 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4da0e2c252c4fb3a4003c39b63b1f75cab8c2063df72d85d6a8a75619b25d803/JSQLParser/JSqlParser/issues/2756 |
| og:image:alt | Failing SQL Feature A cast to a named ROW with one field parses successfully, but both Statement.toString() and StatementDeParser throw NullPointerException. This prevents applications from seriali... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | PHJ2000 |
| hostname | github.com |
| expected-hostname | github.com |
| None | d440bda0d812801778b27bfe9f7c1ce9ff22420c73f6f95150c4fcbca311c50b |
| turbo-cache-control | no-preview |
| go-import | github.com/JSQLParser/JSqlParser git https://github.com/JSQLParser/JSqlParser.git |
| octolytics-dimension-user_id | 4643847 |
| octolytics-dimension-user_login | JSQLParser |
| octolytics-dimension-repository_id | 1944709 |
| octolytics-dimension-repository_nwo | JSQLParser/JSqlParser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1944709 |
| octolytics-dimension-repository_network_root_nwo | JSQLParser/JSqlParser |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 2c43021aed8695990c86c0eaaedc600bfeffec36 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width