Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/bin/pg_dump/pg_dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
42 changes: 21 additions & 21 deletions src/bin/psql/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
{
Expand All @@ -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;
Expand All @@ -113,7 +113,7 @@ static bool isGPDB4200OrLater(void)
{
bool retValue = false;

if (isGPDB() == true)
if (isMPP() == true)
{
PGresult *result;

Expand All @@ -134,7 +134,7 @@ isGPDB4300OrLater(void)
{
bool retValue = false;

if (isGPDB() == true)
if (isMPP() == true)
{
PGresult *result;

Expand All @@ -157,7 +157,7 @@ static bool isGPDB5000OrLater(void)
{
bool retValue = false;

if (isGPDB() == true)
if (isMPP() == true)
{
PGresult *res;

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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())
{
Expand Down
Loading