On 1/28/19 2:53 AM, Kuroda, Hayato wrote:
> BTW, I give you a suggestion about a test.
> This parameter enables users to log statements randomly, hence adding some tests is very difficult.
> Perhaps Only three cases are available:
>
> * When log_transaction_sample_rate is set to 1, all statements are logged.
> * When the parameter is set to 0, they are never logged.
> * When the parameter change to 0 inside the transaction, logging is immediately stopped.
I agree we should add tests, my main problem is log output contains duration
information:
postgres=# select 1;
LOG: duration: 0.539 ms statement: select 1;
I did not find any test for log_min_duration that could help me. LCOV indicate
there is no tests on this part (look check_log_duration()):
https://coverage.postgresql.org/src/backend/tcop/postgres.c.gcov.html
I will look how to test this properly with test infrastructure. Maybe a simple
regex to remove duration part will be enough.