MD_USER_INFO
MD_USER_INFO() is a table function that returns a single row describing the current user and organization for the active connection: user and organization identifiers, the organization's plan type, and the region the organization runs in.
Use it to look up account facts from SQL instead of the MotherDuck UI, for example to find your region when allowlisting Flight egress IP addresses or building your Postgres endpoint hostname.
Syntax
FROM md_user_info();
Output
| Column name | Data type | Value |
|---|---|---|
user_id | VARCHAR | Unique identifier of the current user |
username | VARCHAR | Current MotherDuck user name, the same value returned by MD_USER() |
org_id | VARCHAR | Unique identifier of the user's organization |
org_name | VARCHAR | Display name of the organization |
org_type | VARCHAR | The organization's plan, for example free_trial, lite, or business |
region | VARCHAR | Cloud region the organization runs in, for example us-east-1 or eu-central-1 |
The region column requires DuckDB 1.5.3 or later. Older clients return the remaining columns without region.
Example usage
Run the query below to see the values for your own account:
FROM md_user_info ();
To retrieve a single value, select the column you need:
SELECT region FROM md_user_info();
SaaS mode
MD_USER_INFO() is disabled when connecting in SaaS mode and returns a permission error. It remains available over the Postgres endpoint.
Related
MD_USER— return only the current user name- Postgres endpoint — regional hostnames that use the
regionvalue - Flights: connecting to external systems — egress IP addresses per region