Chapter 13. The System Catalog and INFORMATION_SCHEMA

To keep track of all objects, their relationships, and so on, the RDBMSs use the same technique they are advocating — a set of relational tables and views. This approach was first defined in the SQL:1992 standard (ISO/IEC 9075-2:199x) and was implemented across all major RDBMSs — to a certain degree. The latest update is represented by ISO/IEC 9075-11, which specifies two schemas — INFORMATION_SCHEMA and DEFINITION_SCHEMA; the former provides information about persistent database objects (tables, procedures, and so on), and the latter contains information (data model) about INFORMATION_SCHEMA itself.

SQL System Catalogs

In SQL Standard, a CATALOG is a collection of schemas that contains, among other things, INFORMATION_SCHEMA. It comprises the tables and views that provide all the information about all the other objects and records defined in the database: schemas, tables, privileges, and so on. The latest standard also includes structure and integrity constraints information, as well as security and authorization specifications for the SQL data. The main idea is to provide both users and the RDBMS with a consistent standardized way of accessing metadata (the data about data: table definitions, user-defined types, and so on) as well as some system information. By definition, the INFORMATION_SCHEMA tables and views cannot be updated directly, although some vendors allow this (e.g., IBM DB2). As mandated by the SQL standard, the ...

Get SQL Bible, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.