Unverified 提交 71f0e2a6 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov 提交者: GitHub

Merge pull request #1002 from katzyn/information_schema

Fix INFORMATION_SCHEMA.CONSTRAINTS.CONSTRAINT_TYPE regression
...@@ -1688,7 +1688,8 @@ public class MetaTable extends Table { ...@@ -1688,7 +1688,8 @@ public class MetaTable extends Table {
// CONSTRAINT_NAME // CONSTRAINT_NAME
identifier(constraint.getName()), identifier(constraint.getName()),
// CONSTRAINT_TYPE // CONSTRAINT_TYPE
constraintType.toString(), constraintType == Constraint.Type.PRIMARY_KEY ?
constraintType.getSqlName() : constraintType.name(),
// TABLE_CATALOG // TABLE_CATALOG
catalog, catalog,
// TABLE_SCHEMA // TABLE_SCHEMA
......
...@@ -41,6 +41,18 @@ SELECT CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, IS_DEFERRABLE, INITIALLY_DE ...@@ -41,6 +41,18 @@ SELECT CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, IS_DEFERRABLE, INITIALLY_DE
> FK_2 FOREIGN KEY T2 NO NO > FK_2 FOREIGN KEY T2 NO NO
> rows (ordered): 5 > rows (ordered): 5
SELECT CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, COLUMN_LIST FROM INFORMATION_SCHEMA.CONSTRAINTS
WHERE CONSTRAINT_CATALOG = DATABASE() AND CONSTRAINT_SCHEMA = SCHEMA() AND TABLE_CATALOG = DATABASE() AND TABLE_SCHEMA = SCHEMA()
ORDER BY TABLE_NAME, CONSTRAINT_NAME;
> CONSTRAINT_NAME CONSTRAINT_TYPE TABLE_NAME COLUMN_LIST
> --------------- --------------- ---------- -----------
> PK_1 PRIMARY KEY T1 C1,C2
> U_1 UNIQUE T1 C3,C4
> CH_1 CHECK T2 null
> FK_1 REFERENTIAL T2 C3,C4
> FK_2 REFERENTIAL T2 C3,C4
> rows (ordered): 5
SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE LIMIT 0; SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE LIMIT 0;
> CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT > CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION POSITION_IN_UNIQUE_CONSTRAINT
> ------------------ ----------------- --------------- ------------- ------------ ---------- ----------- ---------------- ----------------------------- > ------------------ ----------------- --------------- ------------- ------------ ---------- ----------- ---------------- -----------------------------
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论