Access metadata

Applications and users can access PostgreSQL metadata through the driver in the following ways:

  • ODBC API functions: The driver supports standard ODBC functions that allow metadata retrieval through the API, without the need to write SQL queries. These functions include SQLColumns, SQLForeignKeys, SQLPrimaryKeys, SQLTables, and more.

    For a complete list of supported functions and detailed descriptions, see ODBC functions for metadata retrieval.

  • System catalogs: PostgreSQL’s metadata is stored in a comprehensive set of system catalog tables, which provide details about datasets, tables, columns, constraints, users, and more. These catalogs are regular tables and can be queried directly using SQL to explore the structure and configuration of your PostgreSQL environment.

    For more information, see System catalogs.

  • Information schema: PostgreSQL also exposes metadata through the ANSI-standard information schema, a collection of read-only views that present database metadata in a portable format. The schema provides a consistent way to query information about tables, columns, constraints, views, and other database objects.

    For more information, see Information schema.