简体   繁体   English

如何在postgresql中知道机器名和程序名?

[英]how to know machine name and program name in postgresql?

select secure_decrypt_log_id_seq.nextval,**v.PROGRAM**, 
'CONTRACT_PAYMENT_ID = '||to_Char(:new.CONTRACT_PAYMENT_ID), sysdate, user, **v.MACHINE**, ls_transaction_type
from v$session v
where v.sid =  (select sid from **v$mystat** where rownum = 1)

I am not able to find equivalent functions in PostgreSQL.我无法在 PostgreSQL 中找到等效的函数。 The above code is of oracle and I cannot find any proper references to Program, Machine & mystat.上面的代码是 oracle 的,我找不到对 Program、Machine 和 mystat 的任何正确引用。 AWS-SCT cannot find similar functions in Postgres AWS-SCT 在 Postgres 中找不到类似的函数

You can have the client address: client_addr in pg_stat_activity (or client_hostname if you have enabled log_hostname ).你可以让客户端地址: client_addrpg_stat_activity (或client_hostname如果启用log_hostname )。

There is no way to access the name of the client executable on the server, as such information is not reliable, but my recommendation is that the client sets the application_name parameter and the server fetches it from pg_stat_activity .无法访问服务器上客户端可执行文件的名称,因为此类信息不可靠,但我的建议是客户端设置application_name参数,服务器从pg_stat_activity获取它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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