diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 7630e596e5c..09681f55105 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -385,17 +385,17 @@ static char *nextToken(register char **stringp, register const char *delim); static void addDistributedBy(Archive *fout, PQExpBuffer q, const TableInfo *tbinfo, int actual_atts); static void addDistributedByOld(Archive *fout, PQExpBuffer q, const TableInfo *tbinfo, int actual_atts); static void addSchedule(Archive *fout, PQExpBuffer q, const TableInfo *tbinfo); -static bool isGPDB(Archive *fout); +static bool isMPP(Archive *fout); static bool isGPDB5000OrLater(Archive *fout); static bool isGPDB6000OrLater(Archive *fout); /* END MPP ADDITION */ /* - * Check if we are talking to GPDB + * Check if we are talking to Greenplum or Cloudberry */ static bool -isGPDB(Archive *fout) +isMPP(Archive *fout) { static int value = -1; /* -1 = not known yet, 0 = no, 1 = yes */ @@ -409,7 +409,7 @@ isGPDB(Archive *fout) res = ExecuteSqlQuery(fout, query, PGRES_TUPLES_OK); ver = (PQgetvalue(res, 0, 0)); - if (strstr(ver, "Cloudberry") != NULL) + if (strstr(ver, "Cloudberry") != NULL || strstr(ver, "Greenplum") != NULL) value = 1; else value = 0; @@ -423,8 +423,8 @@ isGPDB(Archive *fout) static bool isGPDB5000OrLater(Archive *fout) { - if (!isGPDB(fout)) - return false; /* Not Cloudberry at all. */ + if (!isMPP(fout)) + return false; /* Not GP-based at all. */ /* GPDB 5 is based on PostgreSQL 8.3 */ return fout->remoteVersion >= 80300; @@ -434,8 +434,8 @@ isGPDB5000OrLater(Archive *fout) static bool isGPDB6000OrLater(Archive *fout) { - if (!isGPDB(fout)) - return false; /* Not Cloudberry at all. */ + if (!isMPP(fout)) + return false; /* Not GP-based at all. */ /* GPDB 6 is based on PostgreSQL 9.4 */ return fout->remoteVersion >= 90400; diff --git a/src/bin/psql/describe.c b/src/bin/psql/describe.c index 90c8bb777fa..7423459e690 100644 --- a/src/bin/psql/describe.c +++ b/src/bin/psql/describe.c @@ -52,7 +52,7 @@ static bool describeOneTSConfig(const char *oid, const char *nspname, static void printACLColumn(PQExpBuffer buf, const char *colname); static bool listOneExtensionContents(const char *extname, const char *oid); -static bool isGPDB(void); +static bool isMPP(void); static bool isGPDB4200OrLater(void); static bool isGPDB5000OrLater(void); static bool isGPDB6000OrLater(void); @@ -64,7 +64,7 @@ static bool validateSQLNamePattern(PQExpBuffer buf, const char *pattern, const char *visibilityrule, bool *added_clause, int maxparts); -static bool isGPDB(void) +static bool isMPP(void) { static enum { @@ -86,7 +86,7 @@ static bool isGPDB(void) return false; ver = PQgetvalue(res, 0, 0); - if (strstr(ver, "Cloudberry") != NULL) + if (strstr(ver, "Cloudberry") != NULL || strstr(ver, "Greenplum") != NULL) { PQclear(res); talking_to_gpdb = gpdb_yes; @@ -113,7 +113,7 @@ static bool isGPDB4200OrLater(void) { bool retValue = false; - if (isGPDB() == true) + if (isMPP() == true) { PGresult *result; @@ -134,7 +134,7 @@ isGPDB4300OrLater(void) { bool retValue = false; - if (isGPDB() == true) + if (isMPP() == true) { PGresult *result; @@ -157,7 +157,7 @@ static bool isGPDB5000OrLater(void) { bool retValue = false; - if (isGPDB() == true) + if (isMPP() == true) { PGresult *res; @@ -171,8 +171,8 @@ static bool isGPDB5000OrLater(void) static bool isGPDB6000OrLater(void) { - if (!isGPDB()) - return false; /* Not Cloudberry at all. */ + if (!isMPP()) + return false; /* Not GP-based at all. */ /* GPDB 6 is based on PostgreSQL 9.4 */ return pset.sversion >= 90400; @@ -181,8 +181,8 @@ isGPDB6000OrLater(void) static bool isGPDB6000OrBelow(void) { - if (!isGPDB()) - return false; /* Not Cloudberry at all. */ + if (!isMPP()) + return false; /* Not GP-based at all. */ /* GPDB 6 is based on PostgreSQL 9.4 */ return pset.sversion <= 90400; @@ -191,8 +191,8 @@ isGPDB6000OrBelow(void) static bool isGPDB7000OrLater(void) { - if (!isGPDB()) - return false; /* Not Cloudberry at all. */ + if (!isMPP()) + return false; /* Not GP-based at all. */ /* GPDB 7 is based on PostgreSQL v12 */ return pset.sversion >= 120000; @@ -2007,7 +2007,7 @@ describeOneTableDetails(const char *schemaname, "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" : "''"), /* GPDB Only: relstorage */ - (isGPDB() ? "c.relstorage" : "'h'"), + (isMPP() ? "c.relstorage" : "'h'"), oid); } else if (pset.sversion >= 90400) @@ -2027,7 +2027,7 @@ describeOneTableDetails(const char *schemaname, "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" : "''"), /* GPDB Only: relstorage */ - (isGPDB() ? "c.relstorage" : "'h'"), + (isMPP() ? "c.relstorage" : "'h'"), oid); } else if (pset.sversion >= 90100) @@ -2047,7 +2047,7 @@ describeOneTableDetails(const char *schemaname, "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" : "''"), /* GPDB Only: relstorage */ - (isGPDB() ? "c.relstorage" : "'h'"), + (isMPP() ? "c.relstorage" : "'h'"), oid); } else if (pset.sversion >= 90000) @@ -2066,7 +2066,7 @@ describeOneTableDetails(const char *schemaname, "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" : "''"), /* GPDB Only: relstorage */ - (isGPDB() ? "c.relstorage" : "'h'"), + (isMPP() ? "c.relstorage" : "'h'"), oid); } else if (pset.sversion >= 80400) @@ -2084,7 +2084,7 @@ describeOneTableDetails(const char *schemaname, "array(select 'toast.' || x from pg_catalog.unnest(tc.reloptions) x), ', ')\n" : "''"), /* GPDB Only: relstorage */ - (isGPDB() ? "c.relstorage" : "'h'"), + (isMPP() ? "c.relstorage" : "'h'"), oid); } else if (pset.sversion >= 80200) @@ -2098,7 +2098,7 @@ describeOneTableDetails(const char *schemaname, (verbose ? "pg_catalog.array_to_string(reloptions, E', ')" : "''"), /* GPDB Only: relstorage */ - (isGPDB() ? "relstorage" : "'h'"), + (isMPP() ? "relstorage" : "'h'"), oid); } else if (pset.sversion >= 80000) @@ -2161,7 +2161,7 @@ describeOneTableDetails(const char *schemaname, tableinfo.isdynamic = strcmp(PQgetvalue(res, 0, 16), "t") == 0; /* GPDB Only: relstorage */ - if (pset.sversion < 120000 && isGPDB()) + if (pset.sversion < 120000 && isMPP()) tableinfo.relstorage = *(PQgetvalue(res, 0, PQfnumber(res, "relstorage"))); else tableinfo.relstorage = 'h'; @@ -3840,7 +3840,7 @@ describeOneTableDetails(const char *schemaname, * listing them. */ tgdef = PQgetvalue(result, i, 1); - if (isGPDB() && strstr(tgdef, "RI_FKey_") != NULL) + if (isMPP() && strstr(tgdef, "RI_FKey_") != NULL) list_trigger = false; break; @@ -5145,7 +5145,7 @@ listTables(const char *tabtypes, const char *pattern, bool verbose, bool showSys cols_so_far = 4; /* Show Storage type for tables */ - if (showTables && isGPDB()) + if (showTables && isMPP()) { if (isGPDB7000OrLater()) {