Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foreign key info doesn't build correctly using information schema cache V2 #54909

Closed
wjhuang2016 opened this issue Jul 25, 2024 · 0 comments · Fixed by #54959
Closed

foreign key info doesn't build correctly using information schema cache V2 #54909

wjhuang2016 opened this issue Jul 25, 2024 · 0 comments · Fixed by #54959
Labels
component/ddl This issue is related to DDL of TiDB. feature/developing the related feature is in development severity/major type/bug The issue is confirmed as a bug.

Comments

@wjhuang2016
Copy link
Member

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

func (b *Builder) initMisc(dbInfos []*model.DBInfo, policies []*model.PolicyInfo, resourceGroups []*model.ResourceGroupInfo) {
	info := b.infoSchema
	// build the policies.
	for _, policy := range policies {
		info.setPolicy(policy)
	}

	// build the groups.
	for _, group := range resourceGroups {
		info.setResourceGroup(group)
	}

	// Maintain foreign key reference information.
	rs := info.ListTablesWithSpecialAttribute(ForeignKeysAttribute)
	for _, db := range rs {
		for _, tbl := range db.TableInfos {
			info.addReferredForeignKeys(model.NewCIStr(db.DBName), tbl)
		}
	}
}

ListTablesWithSpecialAttribute uses V1 and doesn't get the foreign key tables.

2. What did you expect to see? (Required)

N/A

3. What did you see instead (Required)

N/A

4. What is your TiDB version? (Required)

master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/ddl This issue is related to DDL of TiDB. feature/developing the related feature is in development severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants