fix fk meta - #26469
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
…xone into 0730-fix-fk-meta # Conflicts: # pkg/bootstrap/versions/v4_0_6/upgrade_test.go
XuPeng-SH
left a comment
There was a problem hiding this comment.
Requesting changes for two blocking legacy-upgrade gaps at f8c66fd.\n\n1. pkg/bootstrap/versions/v4_0_6/upgrade.go:129: Foreign keys added with ALTER TABLE are silently left unconverted because mo_tables.rel_createsql is the original CREATE snapshot and ALTER does not rewrite it. Parsing that SQL yields no tree.ForeignKey, legacyForeignKeyMetadataUpdates returns an empty update list, and the tenant upgrade reports success while constraint_id stays 0 and the action stays RESTRICT. The new KEY_COLUMN_USAGE / REFERENTIAL_CONSTRAINTS views therefore remain wrong for this supported path.\n\n2. pkg/bootstrap/versions/v4_0_6/upgrade.go:154: A valid CREATE TABLE with an unnamed FK can abort the whole tenant upgrade. createTableSQLForCatalog persists the original one-statement SQL before adjustConstraintName generates the catalog UUID, so parsing the persisted SQL produces an empty ConstraintSymbol; this branch treats it as an error. The new test at upgrade_test.go:224 currently codifies this valid syntax as an invalid persisted definition.\n\nPlease backfill from authoritative catalog state, or otherwise reconcile missing/unnamed AST constraints with mo_foreign_keys rows, and add upgrade tests for both ALTER-added and unnamed legacy FKs.\n\nLocal validation otherwise passed: all 15 added/modified tests repeated independently under race 100x, all three owning packages under full race, and build/vet/non-race for v4_0_6, bootstrap, plan, compile, sysview, and frontend.
What type of PR is this?
Which issue(s) this PR fixes:
issue #25388
What this PR does / why we need it: