Skip to main content

MD_ATTACHED_DATABASES

MD_ATTACHED_DATABASES() lists the databases attached in your session, including MotherDuck databases, shares, and local databases.

Use SHOW ALL DATABASES when you also want to see detached MotherDuck databases available to you.

Syntax

FROM md_attached_databases();

Output

Column NameData TypeValue
aliasVARCHARAttached database alias
is_shareBOOLEANWhether the attached database is a share
is_readonlyBOOLEANWhether the database is attached read-only
is_error_catalogBOOLEANWhether the attachment is an error catalog
error_messageVARCHARError message for error catalogs, if any
is_ducklakeBOOLEANWhether the attached database is a DuckLake database

Example usage

FROM md_attached_databases();
SELECT alias
FROM md_attached_databases()
WHERE is_share;