Hi Salma

On 30/10/2026 16:25, Salma Elsayed wrote:
> v12 attached.

Thanks for the updated patch.

Before I jump into the test coverage, here a few more comments on the code:

== GUC name (bikeshedding) ==

The name log_object_drops is perhaps not the best fit anymore. The
feature only covers permanent tables, which is much narrower than
"object", and it also covers truncate, which is broader than "_drops". I
don't think we should spend too much time on this right now, but I
thought I should mention it for later.

== wal_level minimal ==

The lsn is being logged also when the cluster is set to wal_level =
minimal. The docs say "The minimal level generates the least WAL volume.
It logs no row information for permanent relations in transactions that
create or rewrite them." [1]

my $minimal = PostgreSQL::Test::Cluster->new('minimal');
$minimal->init;
$minimal->append_conf('postgresql.conf', 'log_object_drops = on');
$minimal->start;
$minimal->safe_psql('postgres',
        'CREATE TABLE t_minimal (id int); DROP TABLE t_minimal;');
unlike(slurp_file($minimal->logfile),
        $any_logged_re, 'nothing is logged with wal_level = minimal');
$minimal->stop;


== errhint in AtEOXact_DropOrTruncateTable (nit) ==

The two branches in  "if (info->is_truncate) can be simplified into a
single ereport call, e.g.


ereport(LOG,
        info->is_truncate ?
        errmsg("table \"%s.%s\" (OID %u) truncated at LSN %X/%08X",
                   info->schemaname, info->relname, info->reloid,
                   LSN_FORMAT_ARGS(XactLastCommitStart)) :
        errmsg("table \"%s.%s\" (OID %u) dropped at LSN %X/%08X",
                   info->schemaname, info->relname, info->reloid,
                   LSN_FORMAT_ARGS(XactLastCommitStart)),
        info == last ?
        errhint("To recover dropped or truncated tables, use "
                        "recovery_target_lsn = '%X/%08X' with "
                        "recovery_target_inclusive = false.",
                        LSN_FORMAT_ARGS(XactLastCommitStart)) : 0);


Best, Jim

1 -
https://www.postgresql.org/docs/current/runtime-config-wal.html#GUC-WAL-LEVEL


Reply via email to