Title: fix: traverse missing query and DML children in TablesNamesFinder by fudianchn · Pull Request #2748 · JSQLParser/JSqlParser · GitHub
Open Graph Title: fix: traverse missing query and DML children in TablesNamesFinder by fudianchn · Pull Request #2748 · JSQLParser/JSqlParser
X Title: fix: traverse missing query and DML children in TablesNamesFinder by fudianchn · Pull Request #2748 · JSQLParser/JSqlParser
Description: AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me. What TablesNamesFinder now visits omitted array subscripts, named function arguments, analytic partitions, initial piped-query joins and lateral views, UPSERT duplicate actions, IF conditions and OUTPUT destinations. MERGE uses the existing OUTPUT traversal shared by INSERT, UPDATE and DELETE. Why SELECT a[(SELECT max(x) FROM t2)] FROM t1 returns only t1 on the base commit instead of t1 and t2. Array slices such as a[OFFSET(1):2] can throw a NullPointerException during table extraction. How Reuse the existing expression-list, join and insert-action helpers to visit the omitted child fields. Check the array index before visiting it, independently of either slice bound. Keep column-processing rules, table-variable handling and existing window traversal. Add the missing MERGE call to the shared OUTPUT visitor. Add regression tests for all public entry paths, adjacent DML consumers, array bounds, finder reuse and visit counts. Root cause Several visitor overrides omit already-parsed child fields. ArrayExpression checks the start bound before dereferencing the single index, which skips ordinary subscripts and dereferences a null index for slices. Testing TablesNamesFinderTraversalTest adds 65 cases. On base bb55bb9d, 39 fail and 26 normal controls pass; the fix passes all 65. Static, instance, expression and other-source entry points are covered. Four isolated mutations are rejected by the tests. JDK 17: both Finder test classes pass, 171 cases total. Full ./gradlew check passes with 9467 cases, zero failures/errors and 25 skipped; mvn clean verify passes with 9449 cases, zero failures/errors and 25 skipped. Formatting, Checkstyle, PMD, SpotBugs, grammar ambiguity, applicable coverage and changed-file license checks pass. Project JMH JSQLParserBenchmark.parseSQLStatements, unchanged 54-statement corpus, version=latest: interleaved baseline/fixed, 3 forks per state, 2 one-second warmups and 5 one-second measurements per fork. Baseline 27.875 ms/op, 99.9% CI [21.312,34.438]; fixed 27.890 ms/op, CI [21.270,34.510], 15 samples per state. The intervals overlap. This parsing benchmark does not exercise TablesNamesFinder. No database-server validation, Finder-specific performance measurement or Windows/macOS local test matrix was run. Behavior notes Returned table sets include names previously omitted. User variables and inserted/deleted pseudo-tables keep their existing statement-entry handling. No grammar or public API changes are required. Slice tests assert index=null and both bound expressions present. Bare f()[1:2] retains its JsonExpression index reading as a normal control; this change does not fix JSON-path grammar or traversal. Existing WITH visitation and expression-entry column-qualification rules remain outside this change. Node-count assertions guard the newly visited fields without promising identity deduplication for arbitrary manually constructed AST graphs. Verification of the original issue No existing issue is linked. The failures were reproduced on upstream master bb55bb9de8377de9880b14e4fe3b3cc94bf63498; the fixed commit is 8f7de28c5a72316ac72d41acf74211f1d34e8dba. This builds on #2479, #2517 and #2538, covering child fields that those changes did not address. SELECT a[(SELECT max(x) FROM t2)] FROM t1; SELECT f()[(SELECT max(x) FROM t2)] FROM t1; SELECT a[OFFSET(1):2] FROM t1; The first two return t1 and t2 with the fix. The slice returns t1 without throwing. The same families are tested through statement and expression entry points.
Open Graph Description: AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me. What TablesNamesFinder now visits omitted array subscripts, named function arguments, analyti...
X Description: AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me. What TablesNamesFinder now visits omitted array subscripts, named function arguments, analyti...
Opengraph URL: https://github.com/JSQLParser/JSqlParser/pull/2748
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
| 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 | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:482d9189-00b0-3532-f4bf-dc6d8d6d810e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | DC22:282FC:227F02:2E5642:6B049959 |
| html-safe-nonce | 76184a25792b2f3797b4ded84a227b8b6c409ee88e4a34c6fc3c90e28e14b496 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQzIyOjI4MkZDOjIyN0YwMjoyRTU2NDI6NkIwNDk5NTkiLCJ2aXNpdG9yX2lkIjoiNzA5NTI4NDAxNTI2MTY3ODk3IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | ba0dfb78a970f862a24f5052a95023713def1bcd2b5c60a88245abf54f6dea1f |
| hovercard-subject-tag | pull_request:4712670129 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/JSQLParser/JSqlParser/pull/2748/files |
| twitter:image | https://avatars.githubusercontent.com/u/40510713?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/40510713?s=400&v=4 |
| og:image:alt | AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me. What TablesNamesFinder now visits omitted array subscripts, named function arguments, analyti... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3fd14143b75b2af7b76bbd23b069867d091adfcc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width