我想知道是否可以通过Node.js应用程序为pg_stat_activity.application_name
提供值。
示例:nodejs myapp.js将显示:NodeJs-我的应用程序
答案 0 :(得分:0)
就像 a_horse_with_no_name 所建议的那样,在创建连接时放置 application_name 就像是一种魅力:
const client = new Client({
user: 'postgres',
host: 'localhost',
database: 'dbname',
password: 'postgres',
port: 5432,
application_name: 'a name', <---- THIS ONE MAKES THE MAGIC :)
});
非常感谢!