Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-05-17 Thread Bruce Momjian
On Thu, May 16, 2024 at 08:37:43AM -0400, Robert Haas wrote: > On Thu, May 16, 2024 at 6:01 AM Quan Zongliang wrote: > > I thought about writing statement log when xid assigned. But it's seemed > > too complicated. > > I'm inclined to keep it for a while. Until we find a good way or give > > up.

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-05-16 Thread Robert Haas
On Thu, May 16, 2024 at 6:01 AM Quan Zongliang wrote: > I thought about writing statement log when xid assigned. But it's seemed > too complicated. > I'm inclined to keep it for a while. Until we find a good way or give > up. It's a reasonable request, after all. I don't think it's reasonable at

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-05-16 Thread Quan Zongliang
On 2024/5/16 00:58, Robert Haas wrote: On Tue, Apr 16, 2024 at 3:16 AM Quan Zongliang wrote: According to the discussion with Jian He. Use the guc hook to check if the xid needs to be output. If needed, the statement log can be delayed to be output. I appreciate the work that both of you

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-05-15 Thread Robert Haas
On Tue, Apr 16, 2024 at 3:16 AM Quan Zongliang wrote: > According to the discussion with Jian He. Use the guc hook to check if > the xid needs to be output. If needed, the statement log can be delayed > to be output. I appreciate the work that both of you have put into this, but I think we

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-04-16 Thread Quan Zongliang
On 2024/3/11 09:25, Quan Zongliang wrote: On 2024/3/4 15:48, jian he wrote: Maybe we can tolerate LOG, first output the query plan then statement. It is more appropriate to let the extension solve its own problems. Of course, this change is not easy to implement. Due to the way XID is

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-03-10 Thread Quan Zongliang
On 2024/3/4 15:48, jian he wrote: Maybe we can tolerate LOG, first output the query plan then statement. It is more appropriate to let the extension solve its own problems. Of course, this change is not easy to implement. Due to the way XID is assigned, there seems to be no good solution

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-03-03 Thread jian he
On Mon, Mar 4, 2024 at 2:12 PM Andrey M. Borodin wrote: > > > On 12 Jan 2024, at 05:51, jian he wrote: > > > > another big difference compare to HEAD: > > Hi Jian, > > thanks for looking into this. Would you be willing to review the next version > of the patch? I just applied

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-03-03 Thread Andrey M. Borodin
> On 12 Jan 2024, at 05:51, jian he wrote: > > another big difference compare to HEAD: Hi Jian, thanks for looking into this. Would you be willing to review the next version of the patch? As long as you are looking into this, you might be interested in registering yourself in a CF entry

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-02-01 Thread Quan Zongliang
A little tweak to the code. GetTopTransactionIdIfAny() != InvalidTransactionId changed to TransactionIdIsValid(GetTopTransactionIdIfAny() On 2024/1/12 08:51, jian he wrote: Hi ... with patch: src3=# explain(analyze, costs off) select 1 from pg_sleep(10); 2024-01-12 08:43:14.750 CST [5739]

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-01-11 Thread jian he
Hi another big difference compare to HEAD: select name,setting frompg_settings where name in ('auto_explain.log_timing','auto_explain.log_analyze', 'auto_explain.log_min_duration','log_statement','log_line_prefix') ; name |

Re: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2024-01-11 Thread jian he
Hi. + /* Log immediately if dictated by log_statement and XID assigned. */ + if (GetTopTransactionIdIfAny() != InvalidTransactionId && + check_log_statement(parsetree_list)) change to + /* Log immediately if dictated by log_statement and XID assigned. */ + if (

Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block

2023-10-07 Thread Quan Zongliang
Implement TODO item: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block Currently it displays zero. Check that the XID has been assigned at the location where the statement log is now printed. If not, no statement log is output. And then