From: | Dave Page <dpage(at)pgadmin(dot)org> |
---|---|
To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Client application name |
Date: | 2009-10-13 15:02:04 |
Message-ID: | 937d27e10910130802v4374b3eeq6d3aea31642e8b2a@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
A useful feature found in other DBMSs such as MS SQL Server that has
been requested on these lists a few times, is the ability for a client
application to report its name to the server. This information may
then be presented in logs, activity reports and so on to aid debugging
and help the sysadmin/DBA see easily what activity is coming from
where on their server.
The attached patch is a first quick cut of the basic functionality to
do this. Currently, it makes the following changes:
- Adds a new userset GUC called application_name.
- Modifies psql to set application_name to 'psql' following connection
to an 8.5 or above server.
- Adds the application_name value to the CSV log output.
- Adds a new parameter %a to the log line prefix which is replaced by
the application_name value.
- Reports the application_name with the other session stats in shared memory.
- Adds application_name to the pg_stat_activity view and
pg_stat_get_activity(int) function.
Work to be done:
- Docs
- libpq modifications
- Set the application_name in pg_dump and pals.
My questions to the group are:
- Is my approach reasonable?
- What interface should I include in libpq?
On the second question, obviously the user can call SET to set a
value, as I've done for now in psql, however in other DBMSs, it may be
set in the connection string. My feeling would be to do that, and
possibly add PQsetApplicationName(PGconn *conn, char *name) and char
*PQapplicationName(PGconn *conn);. What do others think?
(Yes, I know I should technically discuss then code, but I was going
to do this as a pet project to dabble in the server code which I don't
do nearly often enough and figured I'd just send a WIP :-p ).
--
Dave Page
EnterpriseDB UK: http://www.enterprisedb.com
Attachment | Content-Type | Size |
---|---|---|
appname-v1.diff | application/octet-stream | 16.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-10-13 15:06:30 | Re: Client application name |
Previous Message | Tom Lane | 2009-10-13 14:45:03 | Re: EvalPlanQual seems a tad broken |