How to disable LibPQ error messages being printed to console

LibPQ is printing error messages to the console, even though it is expected to fail and I don’t want these messages to show up in the console.

I looked for some LibPQ option(s), but didn’t find anything suitable.

Or would it be possible somehow redirect printout to temporary stream before LibPQ execute call and after redirect it back?

Any suggestion is welcome. Thank you,

I tried to use Suppressor. As soon as it hit @suppress line, it threw ErrorException(“type TeeLogger has no field stream”)

I tried following code

redirect_stdout(open(tempname(), "w")) do
    redirect_stderr(open(tempname(), "w")) do
        executeResult = execute(conn, query)

It didn’t help at all; LibPQ is still printing error(s) to the console…