It’s a nice but tricky solution.
- If the procedure is dropped, so are the grants (doesn't happen if you drop the database 'tracking')
- If the init_connect fails the user is denied access.
It would be nice to let the user know the last login ts. I tried to do this by adding a SELECT at the start of the login_trigger procedure, but this doesn't work.