This is an automated email from the ASF dual-hosted git repository. tuhaihe pushed a commit to branch REL_2_STABLE in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit 8d1a488b6227d4952e2e9c963c2f8df39959d83e Author: Ashwin Agrawal <[email protected]> AuthorDate: Thu Jul 7 15:15:45 2022 -0700 Remove unnecessary partitioning checks in pg_dump Partitioning has existed in GPDB for a long time (4.2 and before). So, no reason to check for existence of these features since we do not support dumps from servers <= GPDB5. Removing the check because we expect these to exist. Fixes https://github.com/greenplum-db/gpdb/issues/5170. --- src/bin/pg_dump/pg_backup.h | 1 - src/bin/pg_dump/pg_dump.c | 39 ++++++++------------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 3445c7594fd..73e0e7c7c0c 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -206,7 +206,6 @@ typedef struct _dumpOptions /* GPDB */ bool dumpGpPolicy; bool isGPbackend; - bool gp_partitioning_available; } DumpOptions; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 0d1f32a3741..430b6fd3dd1 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -385,7 +385,6 @@ static void expand_oid_patterns(SimpleStringList *patterns, static bool is_returns_table_function(int nallargs, char **argmodes); static void testGPbackend(Archive *fout, DumpOptions *dopt); -static void testPartitioningSupport(Archive *fout, DumpOptions *dopt); static char *nextToken(register char **stringp, register const char *delim); static void addDistributedBy(Archive *fout, PQExpBuffer q, const TableInfo *tbinfo, int actual_atts); @@ -1009,11 +1008,6 @@ main(int argc, char **argv) if (fout->isStandby) dopt.no_unlogged_table_data = true; - /* - * Remember whether or not this GP database supports partitioning. - */ - testPartitioningSupport(fout, &dopt); - /* check the version for the synchronized snapshots feature */ if (numWorkers > 1 && fout->remoteVersion < 90200 && !dopt.no_synchronized_snapshots) @@ -17914,10 +17908,12 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) addDistributedBy(fout, q, tbinfo, actual_atts); /* - * If GP partitioning is supported add the partitioning constraints to - * the table definition. + * Add the partitioning constraints to the table definition. This + * check used to look for existence of pg_partition table to make the + * decision, instead seems better to decide based on version. GPDB6 + * and below have pg_get_partition_def functions. */ - if (dopt->gp_partitioning_available) + if (fout->remoteVersion <= 90400) { bool isPartitioned = false; PQExpBuffer query = createPQExpBuffer(); @@ -18009,9 +18005,7 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) } destroyPQExpBuffer(query); - } - - /* END MPP ADDITION */ + } /* END MPP ADDITION */ /* Dump generic options if any */ if (ftoptions && ftoptions[0]) @@ -18183,7 +18177,8 @@ dumpTableSchema(Archive *fout, const TableInfo *tbinfo) tbinfo->attalign[j]); appendStringLiteralAH(q, tbinfo->attnames[j], fout); - if (dopt->gp_partitioning_available) + /* GPDB partitioning */ + if (fout->remoteVersion <= 90400) { /* * Do for all descendants of a partition table. @@ -20812,24 +20807,6 @@ testGPbackend(Archive *fout, DumpOptions *dopt) destroyPQExpBuffer(query); } -/* - * testPartitioningSupport - tests whether or not the current GP - * database includes support for partitioning. - */ -static void -testPartitioningSupport(Archive *fout, DumpOptions *dopt) -{ - PQExpBuffer query = createPQExpBuffer(); - PGresult *res; - - appendPQExpBuffer(query, "SELECT 1 FROM pg_class WHERE relname = 'pg_partition' and relnamespace = 11;"); - res = ExecuteSqlQuery(fout, query->data, PGRES_TUPLES_OK); - - dopt->gp_partitioning_available = (PQntuples(res) == 1); - - PQclear(res); - destroyPQExpBuffer(query); -} /* * addSchedule * --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
