From: | mgr inż(dot) Jacek Bzdak <jbzdak(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: Fwd: Problems with pg_stat_activity view |
Date: | 2013-11-03 20:05:21 |
Message-ID: | CA+FttVMX0BsjkK+RZUDbFHWskFSYEm1zPyW9zjJWXc38rqq4+w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi,
I think that this bug would affect at least couple of other people, but I
agree it is not worth to change deep internal mechanisms just for it.
Maybe changing pg_stat_activity would break existing code, but only for
edge case where this code already behaves incorrectly (by missing existing
connections) --- for example pgAdminIII won't show connections in this
case!
Also using other query wouldn't introduce NULL columns to this view:
SELECT ..., CASE WHEN u.rolname IS NULL THEN 'pg_user_removed` ELSE
> u.rolname END, ... FROM ....;
>
This would break existing code only if they use this particular username,
which is not probable.
Other option I see is just to document two things:
1. How to drop connections connecting to database (there are several
questions on Stack Overflow regarding this, so it is worthwile )
2. Document this behaviour of pg_stat_activity.
I guess I could try to contribute these changes, but I'm not qualified to
decide whether they make sense.
PS. Sorry to be so persistent, but I spent this Friday afternoon and better
part of night chasing this bug!
jb:)
2013/11/3 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> =?ISO-8859-2?Q?mgr_in=BF=2E_Jacek_Bzdak?= <jbzdak(at)gmail(dot)com> writes:
> > Maybe just fix pg_stat_activity so it uses LEFT JOIN, to cover such
> case. I
> > guess it shouldnt break any code?
>
> Meh ... that would result in the usename column being possibly NULL,
> which I bet applications aren't expecting either. I'm not necessarily
> against this, but I'm not sure it'll make things much better.
> Anybody else have an opinion?
>
> (Of course, the real fix would be to prevent dropping user IDs that
> correspond to any live session, but that's not terribly easy either,
> especially if you think about transient settings such as SET ROLE.
> Overall I'm not convinced this is a case worth spending a lot of
> effort on.)
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Maxy | 2013-11-03 20:20:21 | psql security fail? |
Previous Message | Tom Lane | 2013-11-03 02:50:36 | Re: Fwd: Problems with pg_stat_activity view |