Little confusing things about client_min_messages.

Lists: pgsql-hackers
From: Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Little confusing things about client_min_messages.
Date: 2014-03-08 12:03:09
Message-ID: CAC55fYfKkUoP4RLpnaraMQWmoTszaRPt2=FxxoniEO64731OEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

I noticed that the behavior of client_min_messages do not have
a consistency in document and 'pg_settings', postgresql.conf.

----------------
the behaviro is:
I can set 'INFO', 'FATAL' and 'PANIC' as the valid value.

postgres=# set client_min_messages to info;
SET
postgres=# set client_min_messages to fatal;
SET
postgres=# set client_min_messages to panic;
SET

----------------
document says:

<literal>DEBUG1</>, <literal>LOG</>, <literal>NOTICE</>,
<literal>WARNING</>, <literal>ERROR</>, <literal>FATAL</>,
and <literal>PANIC</>. Each level

I couldn't understand the reason of disappearing 'INFO' from the document.

----------------
pg_settings says:

{debug5,debug4,debug3,debug2,debug1,log,notice,warning,error}

and

postgresql.conf says:

#client_min_messages = notice # values in order of decreasing
detail:
# debug5
# debug4
# debug3
# debug2
# debug1
# log
# notice
# warning
# error

also I couldn't understand the reason of disappearing
'info', 'fatal' and 'panic' from them.
----------------

My proposal is all valid values should be present for users.
I fixed this, please see the attached patch.

regards,
-----------
Tomonari Katsumata

Attachment Content-Type Size
clear_client_min_messages.patch application/octet-stream 2.0 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Little confusing things about client_min_messages.
Date: 2014-03-08 16:31:22
Message-ID: 17714.1394296282@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com> writes:
> [ client_min_messages = info is not documented ]

That's intentional, because it's not a useful setting. Even more so
for the other two.

regards, tom lane


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Little confusing things about client_min_messages.
Date: 2014-03-08 16:51:54
Message-ID: 20140308165154.GA4690@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sat, Mar 8, 2014 at 11:31:22AM -0500, Tom Lane wrote:
> Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com> writes:
> > [ client_min_messages = info is not documented ]
>
> That's intentional, because it's not a useful setting. Even more so
> for the other two.

Well, 'info' is between other settings we do document, so I am not clear
why info should be excluded. It is because we always output INFO to the
client? From elog.c:

if (ClientAuthInProgress)
output_to_client = (elevel >= ERROR);
else
output_to_client = (elevel >= client_min_messages ||
elevel == INFO);

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Little confusing things about client_min_messages.
Date: 2014-03-08 17:12:21
Message-ID: 18628.1394298741@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> On Sat, Mar 8, 2014 at 11:31:22AM -0500, Tom Lane wrote:
>> Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com> writes:
>>> [ client_min_messages = info is not documented ]

>> That's intentional, because it's not a useful setting. Even more so
>> for the other two.

> Well, 'info' is between other settings we do document, so I am not clear
> why info should be excluded. It is because we always output INFO to the
> client? From elog.c:

> if (ClientAuthInProgress)
> output_to_client = (elevel >= ERROR);
> else
> output_to_client = (elevel >= client_min_messages ||
> elevel == INFO);

Right, so if you did set it to that, it wouldn't be functionally different
from NOTICE.

I'm not real sure why we allow setting client_min_messages to FATAL or
PANIC at all; seems to me that would break the FE/BE protocol, which says
that command cycles end with either the expected response or ErrorMessage.
In some quick experimentation, libpq/psql don't seem to get as confused as
I thought they would; but the user is sure likely to.

regression=# select 1/0;
ERROR: division by zero
regression=# set client_min_messages TO panic;
SET
regression=# select 1/0;
regression=# slect
regression-# ;
regression=# select 1.0;
?column?
----------
1.0
(1 row)

regression=# foo;
regression=#

So no, I don't think we ought to be advertising these as suggested
values. A saner proposed patch would be to remove them from the
valid values altogether. We probably had some good reason for leaving
them in the list back when, but I'm having a hard time reconstructing
what that would be.

regards, tom lane


From: Tomonari Katsumata <katsumata(dot)tomonari(at)po(dot)ntts(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Little confusing things about client_min_messages.
Date: 2014-03-10 05:51:17
Message-ID: 531D52D5.5050300@po.ntts.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi Tom, Bruce,

Thank you for your response.

(2014/03/09 2:12), Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
>> On Sat, Mar 8, 2014 at 11:31:22AM -0500, Tom Lane wrote:
>>> Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com> writes:
>>>> [ client_min_messages = info is not documented ]
>
>>> That's intentional, because it's not a useful setting. Even more so
>>> for the other two.
>
>> Well, 'info' is between other settings we do document, so I am not clear
>> why info should be excluded. It is because we always output INFO to the
>> client? From elog.c:
>
>> if (ClientAuthInProgress)
>> output_to_client = (elevel >= ERROR);
>> else
>> output_to_client = (elevel >= client_min_messages ||
>> elevel == INFO);
>
> Right, so if you did set it to that, it wouldn't be functionally different
> from NOTICE.
>
I understand it's intensional.
We can set INFO but it doesn't have any difference from NOTICE
because all INFO messages are sent to client.
So it is hidden from the document.

The word "valid" in the document has meant "meaningful".
I've misread it was "setable".

> So no, I don't think we ought to be advertising these as suggested
> values. A saner proposed patch would be to remove them from the
> valid values altogether. We probably had some good reason for leaving
> them in the list back when, but I'm having a hard time reconstructing
> what that would be.
>
Adding FATAL and PANIC to client_min_messages is done at below-commit.
8ac386226d76b29a9f54c26b157e04e9b8368606
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=8ac386226d76b29a9f54c26b157e04e9b8368606

According to the commit log, it seems that the purpose
is suppressing to be sent error message to client when "DROP TABLE".
In those days(pre 8.1), we did not have "DROP IF EXISTS" syntax,
so it was useful.

If this was the reason, now(from 8.2) we have "DROP IF EXISTS" syntax,
so we could delete FATAL and PANIC from client_min_messages valid value.
Attached patch do it. Please check it.

regards,
-----------
Tomonari Katsumata

Attachment Content-Type Size
clear_client_min_messages_v2.patch text/x-diff 1.2 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tomonari Katsumata <katsumata(dot)tomonari(at)po(dot)ntts(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Little confusing things about client_min_messages.
Date: 2014-03-10 14:45:50
Message-ID: 32603.1394462750@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Tomonari Katsumata <katsumata(dot)tomonari(at)po(dot)ntts(dot)co(dot)jp> writes:
> Adding FATAL and PANIC to client_min_messages is done at below-commit.
> 8ac386226d76b29a9f54c26b157e04e9b8368606
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=8ac386226d76b29a9f54c26b157e04e9b8368606

> According to the commit log, it seems that the purpose
> is suppressing to be sent error message to client when "DROP TABLE".
> In those days(pre 8.1), we did not have "DROP IF EXISTS" syntax,
> so it was useful.

> If this was the reason, now(from 8.2) we have "DROP IF EXISTS" syntax,

Uh, that was one example of what it might be good for; I doubt that the
use-case has now vanished entirely. While I'm still dubious about the
reliability of suppressing error messages, if people have been using this
type of coding for nearly 10 years then it probably works well enough
... and more to the point, they won't thank us for arbitrarily removing
it.

I think we should leave established practice alone here. It might be
confusing at first glance, but that doesn't mean it's the wrong thing.

regards, tom lane


From: Tomonari Katsumata <t(dot)katsumata1122(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Tomonari Katsumata <katsumata(dot)tomonari(at)po(dot)ntts(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Little confusing things about client_min_messages.
Date: 2014-03-10 15:55:39
Message-ID: CAC55fYcjT5MvYEk=t0rs--mRSkEBoAPoQM8bpdBfw4v5qEotxA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi

2014-03-10 23:45 GMT+09:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Tomonari Katsumata <katsumata(dot)tomonari(at)po(dot)ntts(dot)co(dot)jp> writes:
> > Adding FATAL and PANIC to client_min_messages is done at below-commit.
> > 8ac386226d76b29a9f54c26b157e04e9b8368606
> >
> http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=8ac386226d76b29a9f54c26b157e04e9b8368606
>
> > According to the commit log, it seems that the purpose
> > is suppressing to be sent error message to client when "DROP TABLE".
> > In those days(pre 8.1), we did not have "DROP IF EXISTS" syntax,
> > so it was useful.
>
> > If this was the reason, now(from 8.2) we have "DROP IF EXISTS" syntax,
>
> Uh, that was one example of what it might be good for; I doubt that the
> use-case has now vanished entirely. While I'm still dubious about the
> reliability of suppressing error messages, if people have been using this
> type of coding for nearly 10 years then it probably works well enough
> ... and more to the point, they won't thank us for arbitrarily removing
> it.
>

Maybe so.

>
> I think we should leave established practice alone here. It might be
> confusing at first glance, but that doesn't mean it's the wrong thing.
>
>
> I see.
If we delete it, it maybe become more confusing thing.

Thank you for your opinion.

regards,
---------------
Tomonari Katsumata