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@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073