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 Name | Data Type | Value |
|---|---|---|
alias | VARCHAR | Attached database alias |
is_share | BOOLEAN | Whether the attached database is a share |
is_readonly | BOOLEAN | Whether the database is attached read-only |
is_error_catalog | BOOLEAN | Whether the attachment is an error catalog |
error_message | VARCHAR | Error message for error catalogs, if any |
is_ducklake | BOOLEAN | Whether the attached database is a DuckLake database |
Example usage
FROM md_attached_databases();
SELECT alias
FROM md_attached_databases()
WHERE is_share;