36.31. key_column_usage

Представление key_column_usage описывает все столбцы в текущей базе, с которыми связано какое-либо ограничение уникальности, либо ограничение первичного или внешнего ключа. Ограничения-проверки в этом представлении не показываются. В нём показываются только те столбцы, к которым имеет доступ текущий пользователь (являясь владельцем или имея некоторые права).

Таблица 36.29. Столбцы key_column_usage

ИмяТип данныхОписание
constraint_catalogsql_identifierИмя базы данных, содержащей ограничение (всегда текущая база)
constraint_schemasql_identifierИмя схемы, содержащей ограничение
constraint_namesql_identifierИмя ограничения
table_catalogsql_identifierИмя базы данных, содержащей таблицу со столбцом, подчиняющимся этому ограничению (всегда текущая база)
table_schemasql_identifierИмя схемы, содержащей таблицу со столбцом, подчиняющимся этому ограничению
table_namesql_identifierИмя таблицы со столбцом, подчиняющимся этому ограничению
column_namesql_identifierИмя столбца, подчиняющегося этому ограничению
ordinal_positioncardinal_numberПорядковый номер столбца в ключе ограничения (нумерация начинается с 1)
position_in_unique_constraintcardinal_numberДля ограничения внешнего ключа это порядковый номер целевого столбца в его ограничении уникальности (нумерация начинается с 1); в противном случае NULL

36.13. column_domain_usage

The view column_domain_usage identifies all columns (of a table or a view) that make use of some domain defined in the current database and owned by a currently enabled role.

Table 36.11. column_domain_usage Columns

NameData TypeDescription
domain_catalogsql_identifierName of the database containing the domain (always the current database)
domain_schemasql_identifierName of the schema containing the domain
domain_namesql_identifierName of the domain
table_catalogsql_identifierName of the database containing the table (always the current database)
table_schemasql_identifierName of the schema containing the table
table_namesql_identifierName of the table
column_namesql_identifierName of the column