darold / pgbadger

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

pgbadger cannot parse sql correctly #798

Closed youxq closed 9 months ago

youxq commented 9 months 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 9 months ago

Commit 4ea7450 fixes this issue.

fredgido commented 8 months 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 8 months ago

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