Fix parameters order for relation_copy_for_cluster
Japin Li <japinli@hotmail.com>
From: Japin Li <japinli@hotmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-04-01T08:12:45Z
Lists: pgsql-hackers
Attachments
- Fix-parameters-order-for-relation_copy_for_cluster.patch (text/x-diff) patch
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
Commits
-
Fix the parameters order for TableAmRoutine.relation_copy_for_cluster()
- 97ce821e3e17 17.0 landed
- bafad43c37bf 16.3 landed
- c2faf48fa3b2 15.7 landed
- 19b8481b42ef 14.12 landed
- 68044d15b737 13.15 landed
- 38585549a3ef 12.19 landed
-
tableam: relation creation, VACUUM FULL/CLUSTER, SET TABLESPACE.
- d25f519107bf 12.0 cited