简体   繁体   中英

Search specific data [POSTGRES]

How to display a user's login time, the name of the machine with which it is connected, the operating system and the program from which it was opened.

I found this query to select active connections, but I do not know where I can find the rest of the information:

SELECT * FROM pg_stat_activity;

any ideas?. Thank you

You don't have the rest of that information. You have what you see in pg_stat_activity , and that's all. PostgreSQL doesn't endevour to find out the host's OS. If you need it, create a user table and write to it when the user connects.

That said, you ask about

  • program, it tells you that in pg_stat_activity.application_name .
  • user's login time, it tells you that in pg_stat_activity.usename ,
  • name of the machine, it tells you that in pg_stat_activity.client_hostname

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM