We currently have --init-command to run command on thread creation, it would be also good to have "on user login" query sequence, which is to be called on user connect as well as on user change. It could allow different users to have different variables, implement access logging and other features. We probably just shall have stored procedure name which is to be called on user login. We could even verify its return code to allow user access or refuce. We can even go further and add "accounting" stored procedure which is called with different parameters on user login/change/logout (or have several stored procedures - each per action) Later we can have more "handlers" these are just the most straightforward.