Re: [PATCH] SQL function to report log message

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, dinesh kumar <dineshkumar02(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] SQL function to report log message
Date: 2015-10-20 20:22:25
Message-ID: CAFj8pRDcHmi3B8BDjc5qsMC4ZM=dRXjUniUQ7r5Sx4Tf8c9jOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2015-10-20 20:05 GMT+02:00 Robert Haas <robertmhaas(at)gmail(dot)com>:

> On Tue, Oct 20, 2015 at 11:29 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
> wrote:
> > 2015-10-20 17:15 GMT+02:00 Robert Haas <robertmhaas(at)gmail(dot)com>:
> >> On Tue, Oct 20, 2015 at 11:09 AM, Pavel Stehule <
> pavel(dot)stehule(at)gmail(dot)com>
> >> wrote:
> >> > Probably it was my request. I don't like to using NULL as value, that
> >> > should
> >> > be ignored. The "hint" is clean, there NULL can be ignored, but what
> >> > about
> >> > DETAIL or MESSAGE?
> >>
> >> If the field is required - as MESSAGE is - then its absence is an
> >> error. If the field is optional, treat a NULL if the parameter were
> >> not supplied.
> >
> > I understand well, what was proposed. Personally I see small risk, but I
> am
> > thinking so can be useful if users can choose between two possibilities
> > (strict, and NULL tolerant). For some adhoc work it can be useful.
>
> You haven't made any attempt to explain why that behavior would be
> useful to anyone except that saying some information might be lost.
> But what field of an error report can sensibly be populated with the
> word NULL, and nothing else?
>

My previous idea was wrong (I didn't though well about all details). I am
sorry. The implementation of variadic parameters in Postgres requires some
default value - in this case the only one logical default value is NULL.
And in this case, when the default is used, the NULL shouldn't be
displayed. I propose following behave. The level and the message arguments
are mandatory (has not default value), others are optional. The level is
should not be NULL, the message can be NULL, and the NULL should be
displayed, any others are ignored if holds NULL. A alternative is - only
the level will be mandatory, others will be optional, and then there are
not any exception for message.

Regards

Pavel

>
> --
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2015-10-20 20:48:20 Re: Multi-column distinctness.
Previous Message Stephen Frost 2015-10-20 20:05:12 Re: bugs and bug tracking