How to check role of current PostgreSQL user from Qt application?

后端 未结 2 550
醉酒成梦
醉酒成梦 2020-12-31 07:42

I have some application based on Qt library and using QPSQL driver.
In PostreSQL defined a few user roles (e.g: admin, operator, user). My application creates a connect

相关标签:
2条回答
  • 2020-12-31 07:43

    You can check PostgreSQL user permissions with this query:

    SELECT * FROM pg_roles;
    
    0 讨论(0)
  • 2020-12-31 08:07

    The manual:

    SELECT current_user;  -- user name of current execution context
    SELECT session_user;  -- session user name
    

    Meaning, session_user shows the role you connected with, and current_user shows the role you are currently operating with, for instance after calling SET role some_other_role;.

    0 讨论(0)
提交回复
热议问题