public inbox for [email protected]
help / color / mirror / Atom feedFrom: Japin Li <[email protected]>
To: PostgreSQL Hackers <[email protected]>
Subject: Fix parameters order for relation_copy_for_cluster
Date: Mon, 01 Apr 2024 16:12:45 +0800
Message-ID: <ME3P282MB3166860D4911AE82F92DF7C5B63F2@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM> (raw)
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
Attachments:
[text/x-diff] Fix-parameters-order-for-relation_copy_for_cluster.patch (608B, ../ME3P282MB3166860D4911AE82F92DF7C5B63F2@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM/2-Fix-parameters-order-for-relation_copy_for_cluster.patch)
download | inline diff:
diff --git a/src/include/access/tableam.h b/src/include/access/tableam.h
index cf76fc29d4..0b79566758 100644
--- a/src/include/access/tableam.h
+++ b/src/include/access/tableam.h
@@ -631,8 +631,8 @@ typedef struct TableAmRoutine
const RelFileLocator *newrlocator);
/* See table_relation_copy_for_cluster() */
- void (*relation_copy_for_cluster) (Relation NewTable,
- Relation OldTable,
+ void (*relation_copy_for_cluster) (Relation OldTable,
+ Relation NewTable,
Relation OldIndex,
bool use_sort,
TransactionId OldestXmin,
view thread (2+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Fix parameters order for relation_copy_for_cluster
In-Reply-To: <ME3P282MB3166860D4911AE82F92DF7C5B63F2@ME3P282MB3166.AUSP282.PROD.OUTLOOK.COM>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox