Skip to main content

Description

Contains information about each detached table.

Columns

  • database (String) — The name of the database the table is in.
  • table (String) — Table name.
  • uuid (UUID) — Table uuid (Atomic database).
  • metadata_path (String) — Path to the table metadata in the file system.
  • is_permanently (UInt8) — Table was detached permanently.

Notes

For DatabaseMySQL and DatabasePostgreSQL, these databases do not own the underlying data — it lives on the remote MySQL/PostgreSQL server. As a result, DROP TABLE on a table from one of these database engines is implemented as detachTablePermanently internally: it only removes ClickHouse’s local tracking of the table, and the table shows up in system.detached_tables with is_permanently = 1, same as an explicit DETACH TABLE PERMANENTLY. The remote data itself is untouched. For persistent MySQL/PostgreSQL databases, the detached state persists across server restarts and reconnections: DatabaseMySQL stores a .remove_flag marker in the metadata directory, while DatabasePostgreSQL stores a .removed marker. Both are reloaded by loadStoredObjects on startup. The table only reappears if a fresh external-database mapping is created without the old metadata directory — for example, if the metadata is removed or the database is created with a different name.

Example

Last modified on August 7, 2026