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

Don Seiler <don@seiler.us>

From: Don Seiler <don@seiler.us>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Stephen Frost <sfrost@snowman.net>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, pgsql-hackers@lists.postgresql.org
Date: 2018-09-21T22:33:18Z
Lists: pgsql-hackers

Attachments

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

> Don Seiler <don@seiler.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

Commits

  1. Add application_name to connection authorized msg