Skip to content

Don't log pgx.QueryResultFormatsByOID#2482

Open
nkonev wants to merge 1 commit intojackc:masterfrom
nkonev:master
Open

Don't log pgx.QueryResultFormatsByOID#2482
nkonev wants to merge 1 commit intojackc:masterfrom
nkonev:master

Conversation

@nkonev
Copy link

@nkonev nkonev commented Jan 18, 2026

Hello!

In case using stdlib.OpenDBFromPool() there is senseless map pgx.QueryResultFormatsByOID like [map[16:1 17:1 20:1 21:1 23:1 26:1 28:1 29:1 700:1 701:1 1082:1 1114:1 1184:1] 3] as the first argument.

Reproducer is here https://github.com/nkonev/pgx-log-repro

Before (branch master of the reproducer)
Screenshot from 2026-01-19 01-22-15

After (branch fix of the reproducer)
Screenshot from 2026-01-19 01-22-00

@jackc
Copy link
Owner

jackc commented Jan 24, 2026

I'm not sure about this. In particular, eliding pgx.QueryRewriter would remove NamedArgs from being logged. That seems undesirable. In an ideal world, there should be a place for a QueryTracer to get the SQL and args after all preprocessing. Perhaps another hook, perhaps final SQL and args get passed to TraceQueryEnd.

@nkonev
Copy link
Author

nkonev commented Jan 24, 2026

@jackc
Generally you are right, but I don't feel so confident in the pgx internals =(

Let's leave this PR open, maybe somebody find a time to make it correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants