Re: [HACKERS] logging statement levels

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [HACKERS] logging statement levels
Date: 2004-04-06 18:09:57
Message-ID: 200404061809.i36I9vv15390@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andrew Dunstan wrote:
> >>However, I think with a little extra work it might be possible to have both.
> >>
> >>
> >
> >Right now, the way it is done, only a real syntax error skips logging.
> >If you referenced an invalid table or something, it does print the log
> >just before the invalid table name mention.
> >
> >How would we test the command type before hitting a syntax error? I
> >can't think of a way, and I am not sure it would even be meaningful.
> >
> >
> >
>
> I agree that you can't test the statement type on a parse error. But
> that doesn't mean to me that "mod" should suppress logging statements
> with syntax errors. In fact, after the discussion surrounding this I
> thought the consensus was to have these things as additive rather than
> just one level selected.

It is additive in that 'mod' also includes 'ddl' queries.

> How to do it in the order you prefer? I would trap the parse error and
> log the statement before emitting the error log.
>
> If I find a simple way I'll submit a further patch.
>
> Certainly your patch contains the guts of what needs to be done in any case.

Right now we have log_min_error_statement:

#log_min_error_statement = panic # Values in order of increasing severity:
# debug5, debug4, debug3, debug2, debug1,
# info, notice, warning, error, panic(off)

which does allow control of printing only statements generating errors,
which includes syntax errors. I don't see why this functionality should
be mixed in with log_statement.

Did you want a 'syntax error' level to log_statement, that would print
only statements with syntax errors but not other errors? That doesn't
seem very useful to me.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-04-06 18:12:08 Re: Function to kill backend
Previous Message Robert Treat 2004-04-06 17:44:37 Re: pg_hba.conf view from the database?

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-04-06 18:38:33 Re: Function to kill backend
Previous Message Serguei Mokhov 2004-04-06 16:59:16 Translation updates for 7.5: pg_resetxlog-ru; pg_controldata-ru; pg_dump-ru; initdb-ru