On 4/5/18 13:07, Alvaro Herrera wrote:
> Note that you start the loop having the Relation; yet you go extra
> length to grab the relnamespace and relname from syscache instead of
> just relations[i]->rd_rel->relname etc.
fixed
> Maybe not a big deal, but for future pg_waldump users I'm sure it'll be
> nice to have the OIDs here.
done
>> +void
>> +ExecuteTruncateGuts(List *explicit_rels, List *relids, List *relids_logged,
>> + DropBehavior behavior, bool restart_seqs)
>> +{
>
> Please add a comment atop this function.
done
>> + /*
>> + * Write a WAL record to allow this set of actions to be logically decoded.
>> + *
>> + * Assemble an array of relids so we can write a single WAL record for the
>> + * whole action.
>> + */
>> + if (list_length(relids_logged) > 0)
>> + {
>> + xl_heap_truncate xlrec;
>> + int i = 0;
>
> I wonder if this should happen only if logical decoding? (Maybe it
> already occurs because relids_logged would be empty? Worth a comment in
> that case)
Added an assertion and a comment.
Committed with those changes.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services