Re: pgsql: Reduce log level of some logical decoding messages from LOG to D

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Reduce log level of some logical decoding messages from LOG to D
Date: 2026-04-12 17:55:26
Message-ID: 340986.1776016526@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Fujii Masao <masao(dot)fujii(at)gmail(dot)com> writes:
> Thanks for the review! I've pushed the patch.

de74d1e9a has had a surprising consequence. Coverity has started to
whine like this about each use of ereport(LogicalDecodingLogLevel():

>>> CID 1691470: Integer handling issues (CONSTANT_EXPRESSION_RESULT)
>>> "((MyBackendType == B_BACKEND) ? 14 : 15) >= 21" is always false regardless of the values of its operands. This occurs as the logical second operand of "&&".
1975 ereport(LogicalDecodingLogLevel(),
1976 errmsg("logical decoding found consistent point at %X/%08X",
1977 LSN_FORMAT_ARGS(lsn)),
1978 errdetail("Logical decoding will begin using saved snapshot."));

It's right of course: neither log level is >= ERROR. I don't see
why that would constitute a bug, so this is just useless nannyism
from Coverity. We could dismiss these complaints as false positives,
but the prospect of having to do that repeatedly in future isn't
attractive. I wonder if anyone sees a way to rewrite to dodge
this complaint. The only thing I can think of is to turn
LogicalDecodingLogLevel() into an out-of-line function, which I
think would silence it ... but I might be wrong, and anyway that's
not a very attractive solution either. Anybody have a better idea?

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2026-04-12 22:43:54 pgsql: Use stack-allocated StringInfoDatas, where possible
Previous Message David Rowley 2026-04-12 10:49:51 pgsql: Doc: use "an SQL" consistently rather than "a SQL"

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-04-12 18:05:02 Re: Reduce build times of pg_trgm GIN indexes
Previous Message Lukas Fittl 2026-04-12 16:38:15 Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?