René's URL Explorer Experiment


Title: fix: traverse skipped expression children in TablesNamesFinder by AndreasLanz01 · Pull Request #2826 · JSQLParser/JSqlParser · GitHub

Open Graph Title: fix: traverse skipped expression children in TablesNamesFinder by AndreasLanz01 · Pull Request #2826 · JSQLParser/JSqlParser

X Title: fix: traverse skipped expression children in TablesNamesFinder by AndreasLanz01 · Pull Request #2826 · JSQLParser/JSqlParser

Description: What TablesNamesFinder skipped some child expressions. A table read by a subquery in one of these positions was missing from getTables(..), getTablesOrOtherSources(..) and findTablesInExpression(..): Node Child that was not visited Function aggregate ORDER BY: string_agg(a, ',' ORDER BY ..), array_agg(a ORDER BY ..), group_concat(a ORDER BY ..); KEEP (DENSE_RANK FIRST ORDER BY ..); HAVING MAX ..; LIMIT ..; keyword arguments such as SEPARATOR ..; an attribute function: f(a).g(..) AnalyticExpression HAVING MAX .., LIMIT .., keyword arguments KeepExpression its ORDER BY (the visit was empty) MySQLGroupConcat all children (the visit was empty); the grammar does not create this node, so this only affects trees built through the API and has no test LikeExpression the ESCAPE expression TimezoneExpression the time zone: d AT TIME ZONE (..) JsonExpression operands after ->, ->>, #>, #>> IsUnknownExpression the operand (the visit was empty) FullTextSearch MATCH (..) AGAINST (..) columns and value (the visit was empty) JsonAggregateFunction key and value of JSON_OBJECTAGG, its ORDER BY, OVER (PARTITION BY .. ORDER BY .. ROWS ..) TableFunction XMLTABLE(.. PASSING ..) in FROM Two private helpers keep this in one place: visitAggregateModifiers (KEEP, HAVING, keyword arguments and LIMIT of Function and AnalyticExpression) and visitWindowElement (window frame, moved out of visit(AnalyticExpression) and reused for JsonAggregateFunction). visit(TableFunction) called visit(function, null), which binds at compile time to visit(Function). XmlTableFunction and JsonTableFunction extend Function, so their own visit methods were never reached. It now calls function.accept(this, context), which also passes the caller's context instead of null. JSON_TABLE is now traversed by visit(JsonTableFunction); the result is the same and is covered by a test. Two outputs change beyond the missing tables: MATCH (..) AGAINST (..) columns are now visited like other qualified columns: findTablesInExpression("MATCH (t.a) AGAINST ('x')") returns [t] (before: []). An attribute column is a field name, not a column reference, so it is not visited: findTablesInExpression("f(a).b.c") returns no table. Why A caller that checks a statement against a table allow-list with TablesNamesFinder never saw t2 in any of these; each returned only t1, or nothing: SELECT string_agg(a, ',' ORDER BY (SELECT max(x) FROM t2)) FROM t1 SELECT a FROM t1 WHERE a LIKE 'a' ESCAPE (SELECT max(x) FROM t2) SELECT now() AT TIME ZONE (SELECT max(x) FROM t2) SELECT j -> (SELECT max(x) FROM t2) FROM t1 -- Dialect.POSTGRESQL SELECT max(a) KEEP (DENSE_RANK FIRST ORDER BY (SELECT x FROM t2)) FROM t1 SELECT a FROM t1 WHERE (SELECT x FROM t2) IS UNKNOWN SELECT * FROM XMLTABLE('/r' PASSING (SELECT x FROM t2) COLUMNS a int PATH 'a') x Testing TablesNamesFinderTraversalTest: nestedTables: 15 new cases, one per skipped child (KEEP, HAVING, LIMIT, SEPARATOR, GROUP_CONCAT ... ORDER BY, attribute function, IS UNKNOWN, MATCH ... AGAINST, the JSON aggregates, XMLTABLE), and 2 controls for JSON_TABLE and a plain table function; new findsTablesInPostgresExpressionChildren, parsed with Dialect.POSTGRESQL, checking getTables and getTablesOrOtherSources: 8 cases for aggregate ORDER BY, ESCAPE, AT TIME ZONE and the four JSON operators; 3 cases for array subscript and slice bounds; 25 controls for positions that were already visited: function arguments, FILTER, WITHIN GROUP, window PARTITION BY / ORDER BY / frame, LIMIT / OFFSET / FETCH, ANY / ALL / SOME, ARRAY(..), VALUES, substring / trim / position / overlay, CASE, casts, GROUP BY / GROUPING SETS, DISTINCT ON, LATERAL; expressionTables: 4 new cases through findTablesInExpression, and the f(a).b.c control; visitsAggregateChildrenOnce: no table is visited twice. On base bdf8ac31 the 28 cases for skipped children fail; the 3 array cases (fixed by #2749) and all controls pass. ./gradlew check on Windows 11 with the JDK 17 toolchain: 10,411 test cases, 0 failures, 0 errors, 25 skipped. Grammar ambiguity, Spotless, Checkstyle, PMD, SpotBugs and JaCoCo verification pass. Not run: mvn verify, JMH (no grammar or parser change), Linux/macOS. Not changed DECLARE @x int = (SELECT ..) and PRAGMA x = (SELECT ..): their visits are empty on purpose (PRAGMA: "no tables involved"). JSON_OBJECTAGG(KEY (SELECT ..) VALUE b) does not parse, so only the VALUE position is tested. visitBinaryExpression(BinaryExpression) still passes a null context to its children; it is public, so I left it alone. Origin First observed with com.manticore-projects.jsqlformatter:jsqlparser:5.4.127 and Dialect.POSTGRESQL. Reproduced on upstream master bdf8ac31bb17b2ae76400a8ddd22a39a990dcc89. The array slice upper bound, also missed in 5.4.127, is already fixed on master by #2749; this PR only adds regression tests for it. No existing issue is linked. AI disclosure: this change was prepared with an AI coding agent (Claude Code) and reviewed by me.

Open Graph Description: What TablesNamesFinder skipped some child expressions. A table read by a subquery in one of these positions was missing from getTables(..), getTablesOrOtherSources(..) and findTablesInExpression(.....

X Description: What TablesNamesFinder skipped some child expressions. A table read by a subquery in one of these positions was missing from getTables(..), getTablesOrOtherSources(..) and findTablesInExpression(.....

Opengraph URL: https://github.com/JSQLParser/JSqlParser/pull/2826

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3

react-profiling0
react-import-mapreact,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-controllerpull_requests
route-actionfiles
fetch-noncev2:f030487f-ba5f-dbdd-dcc7-5d4366c33591
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE064:11BA1E:2D52E2:3CFF4F:6B04962D
html-safe-nonce7ad95ce3419129bc86a8aa2adedb0b24de8e9995cff7373c939b7a823aa25eec
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDY0OjExQkExRToyRDUyRTI6M0NGRjRGOjZCMDQ5NjJEIiwidmlzaXRvcl9pZCI6IjU4ODcyNzAzNjkxNjkyODI2MDUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd040df177a7204a77aba6e717ae49ef2746b99a7536f6b8576d392f7d087f3d9
hovercard-subject-tagpull_request:4872563318
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/JSQLParser/JSqlParser/pull/2826/files
twitter:imagehttps://avatars.githubusercontent.com/u/137876495?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/137876495?s=400&v=4
og:image:altWhat TablesNamesFinder skipped some child expressions. A table read by a subquery in one of these positions was missing from getTables(..), getTablesOrOtherSources(..) and findTablesInExpression(.....
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None9784b6f42e2d5eac4e394fa88cad134c0dc5b6662b4ff2787a1ed1ef5a96331d
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/JSQLParser/JSqlParser git https://github.com/JSQLParser/JSqlParser.git
octolytics-dimension-user_id4643847
octolytics-dimension-user_loginJSQLParser
octolytics-dimension-repository_id1944709
octolytics-dimension-repository_nwoJSQLParser/JSqlParser
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1944709
octolytics-dimension-repository_network_root_nwoJSQLParser/JSqlParser
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release3fd14143b75b2af7b76bbd23b069867d091adfcc
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JSQLParser/JSqlParser/pull/2826/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJSQLParser%2FJSqlParser%2Fpull%2F2826%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJSQLParser%2FJSqlParser%2Fpull%2F2826%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=JSQLParser%2FJSqlParser
Reloadhttps://github.com/JSQLParser/JSqlParser/pull/2826/files
Reloadhttps://github.com/JSQLParser/JSqlParser/pull/2826/files
Reloadhttps://github.com/JSQLParser/JSqlParser/pull/2826/files
JSQLParserhttps://github.com/JSQLParser
JSqlParserhttps://github.com/JSQLParser/JSqlParser
Codehttps://github.com/JSQLParser/JSqlParser
Issues2 (2)https://github.com/JSQLParser/JSqlParser/issues
Pull requests2 (2)https://github.com/JSQLParser/JSqlParser/pulls
Discussionshttps://github.com/JSQLParser/JSqlParser/discussions
Actionshttps://github.com/JSQLParser/JSqlParser/actions
Projectshttps://github.com/JSQLParser/JSqlParser/projects
Wikihttps://github.com/JSQLParser/JSqlParser/wiki
Security and qualityhttps://github.com/JSQLParser/JSqlParser/security
Insightshttps://github.com/JSQLParser/JSqlParser/insights
Sign up for GitHub https://github.com/signup?return_to=%2FJSQLParser%2FJSqlParser%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FJSQLParser%2FJSqlParser%2Fissues%2Fnew%2Fchoose
manticore-projectshttps://github.com/manticore-projects
JSQLParser:masterhttps://github.com/JSQLParser/JSqlParser/tree/master
AndreasLanz01:fix/tables-finder-expression-positionshttps://github.com/AndreasLanz01/JSqlParser/tree/fix/tables-finder-expression-positions
Conversation 1 https://github.com/JSQLParser/JSqlParser/pull/2826
Commits 1 https://github.com/JSQLParser/JSqlParser/pull/2826/commits
Checks 10 https://github.com/JSQLParser/JSqlParser/pull/2826/checks
Files changed https://github.com/JSQLParser/JSqlParser/pull/2826/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2826/files
fix: traverse skipped expression children in TablesNamesFinder https://github.com/JSQLParser/JSqlParser/pull/2826/files#top
Show all changes 1 commit https://github.com/JSQLParser/JSqlParser/pull/2826/files
e0a233a fix: find tables in skipped expression children AndreasLanz01 Oct 15, 2026 https://github.com/JSQLParser/JSqlParser/pull/2826/commits/e0a233a8dcda9a9434f64e68d8b8838fbcdf6fcc
Clear filters https://github.com/JSQLParser/JSqlParser/pull/2826/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2826/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2826/files
TablesNamesFinder.java https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
TablesNamesFinderTraversalTest.java https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.javahttps://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
View file https://github.com/AndreasLanz01/JSqlParser/blob/e0a233a8dcda9a9434f64e68d8b8838fbcdf6fcc/src/main/java/net/sf/jsqlparser/util/TablesNamesFinder.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSQLParser/JSqlParser/pull/2826/{{ revealButtonHref }}
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-316573d4de546d1d0655f069706d16ecd347aad823e413ec72652511badf2294
src/test/java/net/sf/jsqlparser/util/TablesNamesFinderTraversalTest.javahttps://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
View file https://github.com/AndreasLanz01/JSqlParser/blob/e0a233a8dcda9a9434f64e68d8b8838fbcdf6fcc/src/test/java/net/sf/jsqlparser/util/TablesNamesFinderTraversalTest.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSQLParser/JSqlParser/pull/2826/{{ revealButtonHref }}
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
https://github.com/JSQLParser/JSqlParser/pull/2826/files#diff-f40cdafbff2acf49f7688d1d768c00830a5ec3e71bb4faa1b2df221d7472c485
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2826/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlno-cache

Viewport: width=device-width


URLs of crawlers that visited me.