Skip to content

Commit 34c08c8

Browse files
authored
Fix pg_upgrade version parsing (#599)
This is first out of series of patches i plan to make to support Greenplum->Cloudberry migration via pg_upgrade/gpupgrade tool.
1 parent 9b90f90 commit 34c08c8

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/bin/pg_upgrade/exec.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ static void
3333
get_bin_version(ClusterInfo *cluster)
3434
{
3535
char cmd[MAXPGPATH],
36-
cmd_output[MAX_STRING];
36+
cmd_output[MAX_STRING],
37+
dbstring[MAX_STRING];
38+
3739
FILE *output;
3840
int v1 = 0,
3941
v2 = 0;
@@ -47,9 +49,12 @@ get_bin_version(ClusterInfo *cluster)
4749

4850
pclose(output);
4951

50-
if (sscanf(cmd_output, "%*s (Cloudberry Database) %d.%d", &v1, &v2) < 1)
52+
if (sscanf(cmd_output, "%*s (%s Database) %d.%d", dbstring, &v1, &v2) < 1)
5153
pg_fatal("could not get pg_ctl version output from %s\n", cmd);
5254

55+
if (strcmp("Greenplum", dbstring) && strcmp("Cloudberry", dbstring))
56+
pg_fatal("could not upgrade from non Greenplum/Cloudberry version: %s\n", dbstring);
57+
5358
if (v1 < 10)
5459
{
5560
/* old style, e.g. 9.6.1 */

0 commit comments

Comments
 (0)