pgmetrics icon indicating copy to clipboard operation
pgmetrics copied to clipboard

ERROR invalid command '-- ping', use SHOW HELP;

Open komal-habura opened this issue 8 months ago • 4 comments

Pgconn module written by Jackc is only targeted for PostgreSQL, and pgmetrics uses that module for PostgreSQL and pgbouncer, which is leading to this error. pgmetrics takes the first connection to the server and runs a query. Before running the second query, it verifies whether the connection is alive by sending the comment to the server "-- ping" and PostgreSQL accepts it as a comment. But pgbouncer considered it as a command and ran it, which ended up with ERROR invalid command '-- ping', use SHOW HELP;

komal-habura avatar May 23 '25 06:05 komal-habura

Are you seeing this in the pgbouncer logs?

mdevan avatar May 24 '25 02:05 mdevan

Yes

On Sat, 24 May 2025 at 8:04 AM, Mahadevan @.***> wrote:

mdevan left a comment (rapidloop/pgmetrics#78) https://github.com/rapidloop/pgmetrics/issues/78#issuecomment-2906318493

Are you seeing this in the pgbouncer logs?

— Reply to this email directly, view it on GitHub https://github.com/rapidloop/pgmetrics/issues/78#issuecomment-2906318493, or unsubscribe https://github.com/notifications/unsubscribe-auth/APKAO7QDER3VX4XZXJGVWJD277LFFAVCNFSM6AAAAAB5X2UK3OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMBWGMYTQNBZGM . You are receiving this because you authored the thread.Message ID: @.***>

komal-habura avatar May 24 '25 02:05 komal-habura

This is a known "issue". This does not affect pgmetrics' ability to collect data, and only pollutes the pgbouncer log.

Currently, there does not seem to be a way to tell jackc/pgx to not send '-- ping' over the connection. If you know of a way, please do send in a PR or code snippet.

mdevan avatar May 25 '25 03:05 mdevan

can't we use this pkg https://github.com/gocardless/stolon-pgbouncer/blob/v1.5.0/pkg/pgbouncer/pgbouncer.go

komal-habura avatar May 26 '25 05:05 komal-habura