How can I tell what foreign keys have been defined in HSQLDB?
如何判断HSQLDB中定义了哪些外键?
The best I've gleened from the documentation is:
我从文档中得到的最好的是:
select * from INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS;
But that only gave me the following.
但这只给了我以下内容。
CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME UNIQUE_CONSTRAINT_CATALOG UNIQUE_CONSTRAINT_SCHEMA UNIQUE_CONSTRAINT_NAME MATCH_OPTION UPDATE_RULE DELETE_RULE
------------------ ----------------- --------------- ------------------------- ------------------------ ---------------------- ------------ ----------- -----------
PUBLIC PUBLIC SYS_FK_10078 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10079 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION NO ACTION
PUBLIC PUBLIC SYS_FK_10080 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10116 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10120 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10124 PUBLIC PUBLIC SYS_PK_10029 NONE NO ACTION NO ACTION
PUBLIC PUBLIC SYS_FK_10128 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
PUBLIC PUBLIC SYS_FK_10131 PUBLIC PUBLIC SYS_PK_10071 NONE NO ACTION CASCADE
I need to know what tables and columns have foreign keys assigned, and I need to be able to delete them.
我需要知道哪些表和列分配了外键,我需要能够删除它们。
1 个解决方案
#1
6
You can use the following selects in conjunction with the REFERENTIAL_CONSTRAINTS view:
您可以将以下选择与REFERENTIAL_CONSTRAINTS视图结合使用:
select * from information_schema.constraint_column_usage
select * from information_schema.constraint_table_usage
Alternatively, the INFORMATION_SCHEMA.SYSTEM_CROSSREFERENCE view is a self contained view of foreign keys, their tables and columns.
或者,INFORMATION_SCHEMA.SYSTEM_CROSSREFERENCE视图是外键,其表和列的自包含视图。
See http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_information_schema for a list.
有关列表,请参见http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_information_schema。
#1
6
You can use the following selects in conjunction with the REFERENTIAL_CONSTRAINTS view:
您可以将以下选择与REFERENTIAL_CONSTRAINTS视图结合使用:
select * from information_schema.constraint_column_usage
select * from information_schema.constraint_table_usage
Alternatively, the INFORMATION_SCHEMA.SYSTEM_CROSSREFERENCE view is a self contained view of foreign keys, their tables and columns.
或者,INFORMATION_SCHEMA.SYSTEM_CROSSREFERENCE视图是外键,其表和列的自包含视图。
See http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_information_schema for a list.
有关列表,请参见http://hsqldb.org/doc/2.0/guide/databaseobjects-chapt.html#dbc_information_schema。