Daniel Farina <daniel(at)heroku(dot)com> writes:
> What hook would you recommend that matches this criteria:
> * Runs post-authentication
> * ..Once
ClientAuthentication_hook
> My general approach has been to try to use
> GetUserNameFromId(GetSessionUserId()), but this requires
> InitializeSessionUserId be called first, and that has been causing me
> some trouble.
So don't do that. The HBA code uses
roleid = get_role_oid(port->user_name, true);
and actually if you just want the string form you could use
port->user_name without any extra pushups (bearing in mind that
it might or might not be a valid user name).
regards, tom lane