Re: Log query parameters for terminated execute - Mailing list pgsql-hackers

From Sergei Kornilov
Subject Re: Log query parameters for terminated execute
Date
Msg-id 35308731532344646@myt1-bc8ef50fb490.qloud-c.yandex.net
Whole thread Raw
In response to Re: Log query parameters for terminated execute  (Ibrar Ahmed <ibrar.ahmad@gmail.com>)
Responses Re: Log query parameters for terminated execute  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello!

>> After shutdown signal we must be in aborted state, so we mustn't call user-defined I/O functions. (quotation from
commentto errdetail_params in src/backend/tcop/postgres.c ). It seems i can not fix it with current design.
 
>
> No its not about calling the function after abort/shutdown. Just start the server and try to run the program, most of
thetime you will not get params.
 
>
>>> ERROR:  canceling statement due to lock timeout at character 13
>> Hm, "at character"? How can we get this message? I found only "canceling statement due to lock timeout" (without "at
character")ereport in src/backend/tcop/postgres.c
 
>> Maybe try .. catch in parse state, not in execute?
>
> Its really easy to reproduce, just lock the table form another session and run a "c" program to insert row in the
sametable.
 

So, I was right. We can got "canceling statement due to lock timeout at character 13" only in PARSE state. In parse
statewe have completely no parameters, we receive parameters only later in BIND message. I can not log data from
future.
And initially i did change only EXECUTE. Attached patch with similar change in BIND message, if this design is
acceptable.

Please test with logging command tag %i in log_line_prefix. Extended protocol has three different messages, each can be
canceledby timeout. But here is completely no parameters in PARSE and i did not change BIND in first patch.
 

regards, Sergei
Attachment

pgsql-hackers by date:

Previous
From: Nikhil Sontakke
Date:
Subject: Re: [HACKERS] logical decoding of two-phase transactions
Next
From: Amit Kapila
Date:
Subject: Re: [bug fix] Produce a crash dump before main() on Windows