René's URL Explorer Experiment


Title: Use one foreign-key state in ALTER TABLE by minleejae · Pull Request #2764 · JSQLParser/JSqlParser · GitHub

Open Graph Title: Use one foreign-key state in ALTER TABLE by minleejae · Pull Request #2764 · JSQLParser/JSqlParser

X Title: Use one foreign-key state in ALTER TABLE by minleejae · Pull Request #2764 · JSQLParser/JSqlParser

Description: Purpose Make ALTER foreign-key edits consistent across the structured and legacy APIs. For example, after parsing an ADD FOREIGN KEY, setFkSourceTable("parent_history") currently changes the legacy getter while the SQL still references the original table. Current design (As-is) After #2747 separates constraints from indexes, AlterExpression still copies four FK properties and referential actions from ForeignKeyConstraint. Its renderer prefers the structured definition, so legacy edits can be ignored, replacement definitions leave stale getter values, and action column lists are absent from the copied state. A separate legacy renderer and validator path maintain these copies. Target design (To-be) Keep one ForeignKeyConstraint/ForeignKeyReference. Remove the duplicate FK fields, action store, grammar copying and fallback renderer; delegate existing FK accessors to that definition. Share referenced-column lists and action objects. Make local FK names a rendered snapshot, matching PK/UK accessors; setters/adders and structured key elements provide editing APIs. Create an FK for non-null legacy writes only when no competing definition exists. Reject writes over another constraint, index or legacy PK/UK. Absent reads, clears and removals create no payload; replacing the constraint exposes only the replacement. Preserve the reference table object, catalogue and quoted identifier parts. Fix withFkSourceSchema() and validate the current structured target/columns without a second unqualified-table lookup. Document the editing and snapshot contracts. PK/UK fallback cleanup and separate DROP targets are handled by #2771. The FK creation guard uses the existing key accessors so it remains compatible when that follow-up removes their backing fields. This PR keeps the parent’s index/constraint separation and does not expand SQL grammar. Validation Java 17 Gradle check passes: 9,964 tests, 9,939 passed, 25 skipped, zero failures/errors; grammar, formatting, Checkstyle, PMD, SpotBugs and coverage checks pass. 15 FK regression cases plus one validator case cover MySQL/PostgreSQL mutation, rendering/reparsing, action column lists, quoted names, replacement/null handling and competing definitions. Running the FK cases on the parent produces 13 failures and two passing controls. Before the parent merge, replayed 882 previously DB-validated DDL fixtures through the parser: 875 supported cases have unchanged AST inspection and SQL outputs; seven existing parse gaps remain. Error differences are generated grammar locations only. No fresh live DB replay. #2747 is now merged. Rebased only this follow-up onto current master (cdbaf1ad), verified that its patch is unchanged, and reran the complete checks above. Integration check with the other independent refactors (#2764–#2768): all five patches apply without conflicts; full Java 17 Gradle check passes with 10,030 tests (10,005 passed, 25 skipped). Replaying 882 previously DB-validated fixtures preserves the AST and both SQL outputs for 875 supported cases, with the same seven existing parse gaps and no semantic regression. No fresh database execution. The accessor-only compatibility adjustment for #2771 was also verified with the complete Java 17 Gradle check; all checks pass.

Open Graph Description: Purpose Make ALTER foreign-key edits consistent across the structured and legacy APIs. For example, after parsing an ADD FOREIGN KEY, setFkSourceTable("parent_history") currently changes ...

X Description: Purpose Make ALTER foreign-key edits consistent across the structured and legacy APIs. For example, after parsing an ADD FOREIGN KEY, setFkSourceTable("parent_history") currently ...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.112.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:c2893118-0a6a-c974-9c41-e5dc0b1a9ae9
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id998A:1514D:B0D8B0:F19ADE:6B048886
html-safe-noncefe6f2438403eafc7fafa102e88e0b4f49013c01d845d3efb6bf9e2594c1fb11d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5OThBOjE1MTREOkIwRDhCMDpGMTlBREU6NkIwNDg4ODYiLCJ2aXNpdG9yX2lkIjoiMTQ0NTA1NTEyMjA0MjA4MjYyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmacd4c16b006b74741a10961a2d450138d3378818dcba332487d3f407dcfefb8b74
hovercard-subject-tagpull_request:4817404887
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/2764/files
twitter:imagehttps://avatars.githubusercontent.com/u/55116920?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/55116920?s=400&v=4
og:image:altPurpose Make ALTER foreign-key edits consistent across the structured and legacy APIs. For example, after parsing an ADD FOREIGN KEY, setFkSourceTable("parent_history") currently changes ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None1d5c152376e38b7d2e37f3d5179be29a73bee93b85110da28a4eebe1159cdc70
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
releasef5017e8ff4ea25a8011fcf0f2a0e430c60dc86c8
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/JSQLParser/JSqlParser/pull/2764/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FJSQLParser%2FJSqlParser%2Fpull%2F2764%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%2F2764%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/2764/files
Reloadhttps://github.com/JSQLParser/JSqlParser/pull/2764/files
Reloadhttps://github.com/JSQLParser/JSqlParser/pull/2764/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
minleejae:refactor/alter-foreign-key-state-20261011https://github.com/minleejae/JSqlParser/tree/refactor/alter-foreign-key-state-20261011
Conversation 1 https://github.com/JSQLParser/JSqlParser/pull/2764
Commits 2 https://github.com/JSQLParser/JSqlParser/pull/2764/commits
Checks 10 https://github.com/JSQLParser/JSqlParser/pull/2764/checks
Files changed https://github.com/JSQLParser/JSqlParser/pull/2764/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2764/files
Use one foreign-key state in ALTER TABLE https://github.com/JSQLParser/JSqlParser/pull/2764/files#top
Show all changes 2 commits https://github.com/JSQLParser/JSqlParser/pull/2764/files
dd8b5c3 Use one foreign-key state in ALTER TABLE minleejae Oct 11, 2026 https://github.com/JSQLParser/JSqlParser/pull/2764/commits/dd8b5c35e407bff45fd0e9a5072968913e6ca891
f34191d Use key accessors when checking competing foreign key definitions minleejae Oct 11, 2026 https://github.com/JSQLParser/JSqlParser/pull/2764/commits/f34191ddce2e13f61dcf9a9c5247bb500f6673c8
Clear filters https://github.com/JSQLParser/JSqlParser/pull/2764/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2764/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2764/files
AlterExpression.java https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
AlterValidator.java https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
JSqlParserCC.jjt https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-d323df58a0300a038ac87b328bf05b8255ff06e6b5d0e9aeae641fa566e4068c
usage.rst https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-1d76e581381361db03988ab6bd07be336cb8129b61bda04ab3fe334209488c2c
AlterForeignKeyStateTest.java https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-e5b19765a2ae86020730b9932b13612aa57bb556a3a22b6f5a25af7870cdf3c8
AlterValidatorTest.java https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fee1a431929d11f6f974d511e99974f4c99176f26eeca7b86bf4b7e73d042a23
src/main/java/net/sf/jsqlparser/statement/alter/AlterExpression.javahttps://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
View file https://github.com/minleejae/JSqlParser/blob/f34191ddce2e13f61dcf9a9c5247bb500f6673c8/src/main/java/net/sf/jsqlparser/statement/alter/AlterExpression.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSQLParser/JSqlParser/pull/2764/{{ revealButtonHref }}
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-fc44472f677ed768eaa549485c7ef8096a5efb18be17c46e44c1ed5c6348ef4b
src/main/java/net/sf/jsqlparser/util/validation/validator/AlterValidator.javahttps://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
View file https://github.com/minleejae/JSqlParser/blob/f34191ddce2e13f61dcf9a9c5247bb500f6673c8/src/main/java/net/sf/jsqlparser/util/validation/validator/AlterValidator.java
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/JSQLParser/JSqlParser/pull/2764/{{ revealButtonHref }}
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
https://github.com/JSQLParser/JSqlParser/pull/2764/files#diff-ff8446297be47c820ffc21e07c861f869e77d4cae3916cc9dfb4caad1465a06b
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2764/files
Please reload this pagehttps://github.com/JSQLParser/JSqlParser/pull/2764/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.