I have found incorrect error message in InitializeSessionUserId function if you try to connect to database by role Oid (for example BackgroundWorkerInitializeConnectionByOid). If role have no permissions to login, you will see error message like this: FATAL: role "(null)" is not permitted to log in
I changed few lines of code and fixed this. Patch is attached. I want to add this patch to commitfest. Any objections?