Re: [PATCH] Include application_name in "connection authorized" log message

From: Don Seiler <don(at)seiler(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] Include application_name in "connection authorized" log message
Date: 2018-09-21 22:33:18
Message-ID: CAHJZqBAaE8soR05Rqoa+OT6dqu5ejQqr7Kk1EqFrZZBeNBVNKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Aug 7, 2018 at 12:32 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Don Seiler <don(at)seiler(dot)us> writes:
>
> > 1. We want to make a generic, central ascii-lobotomizing function similar
> > to check_application_name that we can re-use there and for other checks
> (eg
> > user name).
> > 2. Change check_application_name to call this function (or just call this
> > function instead of check_application_name()?)
>
> check_application_name's API is dictated by the GUC check-hook interface,
> and doesn't really make sense for this other use. So the first part of
> that, not the second.
>
> > 3. Call this function when storing the value in the port struct.
>
> I'm not sure where exactly is the most sensible place to call it,
> but trying to minimize the number of places that know about this
> kluge seems like a good principle.
>

OK I created a new function called clean_ascii() in common/string.c. I call
this from my new logic in postmaster.c as well as replacing the logic in
guc.c's check_application_name() and check_cluster_name().

I've been fighting my own confusion with git and rebasing and fighting the
same conflicts over and over and over, but this patch should be what I
want. If anyone has time to review my git process, I would appreciate it. I
must be doing something wrong to have these same conflicts every time I
rebase (or I completely misunderstand what it actually does).

Thanks,
Don.

--
Don Seiler
www.seiler.us

Attachment Content-Type Size
0001-Changes-to-add-application_name-to-Port-struct-so-we.patch application/octet-stream 5.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-09-21 22:35:02 Re: transction_timestamp() inside of procedures
Previous Message Tom Lane 2018-09-21 22:00:35 Re: [PATCH] Tab completion for ALTER DATABASE … SET TABLESPACE