Logging transaction IDs for DDL.

From: Vik Fearing <vik(dot)fearing(at)2ndquadrant(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Logging transaction IDs for DDL.
Date: 2018-06-13 22:34:54
Message-ID: ecb47a54-66a7-ced7-a035-78791e8e4fc4@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I just noticed a problem with log_statement = 'ddl' and log_line_prefix
containing '%x'. If the statement is the first in the transaction, it
will be logged before it is executed, and more importantly, before a
transaction ID is assigned. That means that %x will be 0.

If the administrator has configured postgres like this in order to ease
PITR on bad DDL, it's actually of no use whatsoever and they'll have to
use pg_waldump to try to figure things out.

PFA a simple patch that I hope addresses the issue in a clean way. It
also handles the same problem for 'mod'.

I'm undecided whether this is a bugfix or an improvement. I'm leaning
towards bugfix.
--
Vik Fearing +33 6 46 75 15 36
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

Attachment Content-Type Size
log_xid.v01.patch text/x-patch 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-06-13 22:45:25 Re: Logging transaction IDs for DDL.
Previous Message Michael Paquier 2018-06-13 22:21:29 Re: Portability concerns over pq_sendbyte?