FirebirdSQL logo

USER

Name of the user of the current connection

Type

VARCHAR(63)

Syntax
USER

USER is equivalent to (or, alias of) [fblangref50-contextvars-current-user].

Example
create trigger bi_customers for customers before insert as
begin
  New.added_by  = USER;
  New.purchases = 0;
end

CURRENT_ROLE

Current explicit role of the connection

Type

VARCHAR(63)

Syntax
CURRENT_ROLE

CURRENT_ROLE is a context variable containing the explicitly specified role of the currently connected user.If there is no explicitly specified role, CURRENT_ROLE is 'NONE'.

CURRENT_ROLE always represents a valid role or 'NONE'.If a user connects with a non-existing role, the engine silently resets it to 'NONE' without returning an error.

Note

Roles that are active by default and not explicitly specified on connect or using SET ROLE are not returned by CURRENT_ROLE.Use RDB$ROLE_IN_USE to check for all active roles.

Example
if (current_role <> 'MANAGER')
  then exception only_managers_may_delete;
else
  delete from Customers where custno = :custno;
See also

RDB$ROLE_IN_USE