darold / pgbadger

A fast PostgreSQL Log Analyzer
http://pgbadger.darold.net/
PostgreSQL License
3.57k stars 353 forks source link

pgbadger cannot parse sql correctly #798

Closed youxq closed 1 year ago

youxq commented 1 year ago

Hi, when I use pgbadger to analyze the log, some SQL cannot be parsed correctly and will be parsed into select ; in the report;

version: 12.2 command: pgbadger --prefix '%m [%p]: user=%u,db=%d,app=%a,client=%h' -v ./postgres.log -o reports.html log example:

2023-10-13 09:34:33.136 UTC [57]: user=prisma,db=prisma,app=PostgreSQL JDBC Driver,client=127.0.0.1 LOG:  duration: 0.247 ms  bind S_899: select
      * from test where id = $1
2023-10-13 09:34:34.014 UTC [57]: user=prisma,db=prisma,app=PostgreSQL JDBC Driver,client=127.0.0.1 DETAIL:  parameters: $1 = 'test'
2023-10-13 09:34:33.136 UTC [57]: user=prisma,db=prisma,app=PostgreSQL JDBC Driver,client=127.0.0.1 LOG:  duration: 0.247 ms  execute S_899: select
      * from test where id = $1
2023-10-13 09:34:34.014 UTC [57]: user=prisma,db=prisma,app=PostgreSQL JDBC Driver,client=127.0.0.1 DETAIL:  parameters: $1 = 'test'

report screenshot:

image

I don't understand why we get this error, maybe I'm missing something ? Thank you.

darold commented 1 year ago

Commit 4ea7450 fixes this issue.

fredgido commented 1 year ago

Commit 4ea7450 fixes this issue.

@darold Sorry but this commit doesn't exist? I also have problems when we have server bind arguments, aka when it has parameters: $1 = 'test'

darold commented 1 year ago

Sorry, it looks like the git push had failed due to connection timeout. It is pushed now.