MD_USER
MD_USER() returns the current MotherDuck user name for the active connection.
In MotherDuck sessions, USER, CURRENT_USER(), and SESSION_USER resolve to the same value.
Syntax
SELECT md_user();
-- Equivalent aliases in a MotherDuck session
SELECT user;
SELECT user();
SELECT current_user();
SELECT session_user;
info
Note that DuckDB and MotherDuck allow you to use niladic (no-argument) functions like user also as a column name. This can lead to a silent failure with unexpected values when dropping a user column.
Output
| Column Name | Data Type | Value |
|---|---|---|
md_user() | VARCHAR | Current MotherDuck user name |
Example usage
SELECT md_user();
SELECT current_user();
note
If you are not connected to MotherDuck, DuckDB may return its default local user instead.