Skip to main content

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 nameData typeValue
user_idVARCHARUnique identifier of the current user
usernameVARCHARCurrent MotherDuck user name, the same value returned by MD_USER()
org_idVARCHARUnique identifier of the user's organization
org_nameVARCHARDisplay name of the organization
org_typeVARCHARThe organization's plan, for example free_trial, lite, or business
regionVARCHARCloud region the organization runs in, for example us-east-1 or eu-central-1
note

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:

Look up your user and organization info
FROM
  md_user_info ();
SQL Editor loading...
Login to connect
PreviewLogin for live results

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.