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

From: Quan Zongliang <quanzongliang(at)yeah(dot)net>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix log_line_prefix to display the transaction id (%x) for statements not in a transaction block
Date: 2023-10-08 03:50:43
Message-ID: 12fa0c9a-2189-ed7a-016a-3f1b99bd756c@yeah.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 before finish_xact_command. If the statement has not been
output to the log. Here the log can get XID.

DML that does not manipulate any data still does not get XID.

[32718][788] LOG: statement: insert into t1 values(1,0,'');
[32718][789] LOG: statement: delete from t1;
[32718][0] LOG: statement: delete from t1;

--
Quan Zongliang

Attachment Content-Type Size
postgres.patch text/plain 1.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2023-10-08 04:14:12 Re: Fix output of zero privileges in psql
Previous Message vignesh C 2023-10-08 02:52:28 Re: Invalidate the subscription worker in cases where a user loses their superuser status