Fix parameters order for relation_copy_for_cluster

From: Japin Li <japinli(at)hotmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Fix parameters order for relation_copy_for_cluster
Date: 2024-04-01 08:12:45
Message-ID: ME3P282MB3166860D4911AE82F92DF7C5B63F2@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hi,

When attempting to implement a new table access method, I discovered that
relation_copy_for_cluster() has the following declaration:

void (*relation_copy_for_cluster) (Relation NewTable,
Relation OldTable,
Relation OldIndex,
bool use_sort,
TransactionId OldestXmin,
TransactionId *xid_cutoff,
MultiXactId *multi_cutoff,
double *num_tuples,
double *tups_vacuumed,
double *tups_recently_dead);

It claims that the first parameter is a new table, and the second one is an
old table. However, the table_relation_copy_for_cluster() uses the first
parameter as the old table, and the second as a new table, see below:

static inline void
table_relation_copy_for_cluster(Relation OldTable, Relation NewTable,
Relation OldIndex,
bool use_sort,
TransactionId OldestXmin,
TransactionId *xid_cutoff,
MultiXactId *multi_cutoff,
double *num_tuples,
double *tups_vacuumed,
double *tups_recently_dead)
{
OldTable->rd_tableam->relation_copy_for_cluster(OldTable, NewTable, OldIndex,
use_sort, OldestXmin,
xid_cutoff, multi_cutoff,
num_tuples, tups_vacuumed,
tups_recently_dead);
}

It's a bit confusing, so attach a patch to fix this.

--
Regards,
Japin Li

Attachment Content-Type Size
Fix-parameters-order-for-relation_copy_for_cluster.patch text/x-diff 608 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2024-04-01 08:56:00 Re: remaining sql/json patches
Previous Message Bertrand Drouvot 2024-04-01 07:18:55 Re: Introduce XID age and inactive timeout based replication slot invalidation