returns the ID of the current user if he is running on the server, NULL otherwise.
I assumed that the ID returned corresponds to the RecID in the "sysuser" master.vdb table, and is a constant for the connecting user, i.e.
SELECT RecID, fld_name FROM sysuser WHERE fld_name = 'EMB';
=> 1, EMB
and envisioned using it as a record owner identifier to organize something like a row policy
CREATE TABLE "test"(
...
"USER_CREATE" USHORT DEFAULT METHOD( 'ifnull( current_user_id(), 0 )' ) NOT NULL,
"DATE_CREATE" DATE DEFAULT METHOD( 'current_date()' ) NOT NULL );
But the value returned by the function changes randomly from session to session for the same user.
SELECT current_user_id(), current_user_name();
=> 968, EMB
SELECT current_user_id(), current_user_name();
=> 940, EMB
SELECT current_user_id(), current_user_name();
=> 1004, EMB
It is not clear what the meaning of this function is and how it is supposed to be used?