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

[Feature Request]: Implement information_schema.table_constraints #21423

Closed
1 task done
fengttt opened this issue Feb 19, 2025 · 3 comments
Closed
1 task done

[Feature Request]: Implement information_schema.table_constraints #21423

fengttt opened this issue Feb 19, 2025 · 3 comments
Assignees
Labels
kind/feature phase/testing priority/p0 Critical feature that should be implemented in this version
Milestone

Comments

@fengttt
Copy link
Contributor

fengttt commented Feb 19, 2025

Is there an existing issue for the same feature request?

  • I have checked the existing issues.

Is your feature request related to a problem?

Right now information_schema.table_constraints is a table, no data. 


	InformationSchemaTableConstraintsDDL = "CREATE TABLE information_schema.TABLE_CONSTRAINTS (" +
		"CONSTRAINT_CATALOG varchar(64)," +
		"CONSTRAINT_SCHEMA varchar(64)," +
		"CONSTRAINT_NAME varchar(64)," +
		"TABLE_SCHEMA varchar(64)," +
		"TABLE_NAME varchar(64)," +
		"CONSTRAINT_TYPE varchar(11) NOT NULL DEFAULT ''," +
		"ENFORCED varchar(3) NOT NULL DEFAULT ''" +
		")"


This implementation is essentially wrong.   EVERYTHING in information_schema should be a view.   So the implementation should be like the following, 


InformationSchemaReferentialConstraintsDDL = "CREATE VIEW information_schema.REFERENTIAL_CONSTRAINTS AS " +
		"SELECT DISTINCT " +
		"'def' AS CONSTRAINT_CATALOG, " +
		"fk.db_name AS CONSTRAINT_SCHEMA, " +
		"fk.constraint_name AS CONSTRAINT_NAME, " +
		"'def' AS UNIQUE_CONSTRAINT_CATALOG, " +
		"fk.refer_db_name AS UNIQUE_CONSTRAINT_SCHEMA, " +
		"idx.type AS UNIQUE_CONSTRAINT_NAME," +
		"'NONE' AS MATCH_OPTION, " +
		"fk.on_update AS UPDATE_RULE, " +
		"fk.on_delete AS DELETE_RULE, " +
		"fk.table_name AS TABLE_NAME, " +
		"fk.refer_table_name AS REFERENCED_TABLE_NAME " +
		"FROM mo_catalog.mo_foreign_keys fk " +
		"JOIN mo_catalog.mo_indexes idx ON (fk.refer_column_name = idx.column_name)"

Describe the feature you'd like

Seems mo_catalog.mo_indexes has everything you need, so just a view on it should probably be fine.

There needs to be an upgrade step.

Describe implementation you've considered

No response

Documentation, Adoption, Use Case, Migration Strategy

Additional information

No response

@volgariver6 volgariver6 added this to the 2.0.2 milestone Feb 20, 2025
@volgariver6 volgariver6 added the priority/p0 Critical feature that should be implemented in this version label Feb 20, 2025
@volgariver6
Copy link
Contributor

经讨论,该问题尽快处理,进2.0.2版本

@ck89119
Copy link
Contributor

ck89119 commented Feb 20, 2025

working on it

@heni02
Copy link
Contributor

heni02 commented Feb 25, 2025

相关联的bug已验证,confrim,closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature phase/testing priority/p0 Critical feature that should be implemented in this version
Projects
None yet
Development

No branches or pull requests

6 participants