mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Stamp HEAD as 10devel.
This is a good bit more complicated than the average new-version stamping commit, because it includes various adjustments in pursuit of changing from three-part to two-part version numbers. It's likely some further work will be needed around that change; but this is enough to get through the regression tests, at least in Unix builds. Peter Eisentraut and Tom Lane
This commit is contained in:
@ -1334,16 +1334,13 @@ ValidatePgVersion(const char *path)
|
||||
char full_path[MAXPGPATH];
|
||||
FILE *file;
|
||||
int ret;
|
||||
long file_major,
|
||||
file_minor;
|
||||
long my_major = 0,
|
||||
my_minor = 0;
|
||||
long file_major;
|
||||
long my_major;
|
||||
char *endptr;
|
||||
const char *version_string = PG_VERSION;
|
||||
char file_version_string[64];
|
||||
const char *my_version_string = PG_VERSION;
|
||||
|
||||
my_major = strtol(version_string, &endptr, 10);
|
||||
if (*endptr == '.')
|
||||
my_minor = strtol(endptr + 1, NULL, 10);
|
||||
my_major = strtol(my_version_string, &endptr, 10);
|
||||
|
||||
snprintf(full_path, sizeof(full_path), "%s/PG_VERSION", path);
|
||||
|
||||
@ -1362,8 +1359,11 @@ ValidatePgVersion(const char *path)
|
||||
errmsg("could not open file \"%s\": %m", full_path)));
|
||||
}
|
||||
|
||||
ret = fscanf(file, "%ld.%ld", &file_major, &file_minor);
|
||||
if (ret != 2)
|
||||
file_version_string[0] = '\0';
|
||||
ret = fscanf(file, "%63s", file_version_string);
|
||||
file_major = strtol(file_version_string, &endptr, 10);
|
||||
|
||||
if (ret != 1 || endptr == file_version_string)
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("\"%s\" is not a valid data directory",
|
||||
@ -1374,13 +1374,13 @@ ValidatePgVersion(const char *path)
|
||||
|
||||
FreeFile(file);
|
||||
|
||||
if (my_major != file_major || my_minor != file_minor)
|
||||
if (my_major != file_major)
|
||||
ereport(FATAL,
|
||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||
errmsg("database files are incompatible with server"),
|
||||
errdetail("The data directory was initialized by PostgreSQL version %ld.%ld, "
|
||||
errdetail("The data directory was initialized by PostgreSQL version %s, "
|
||||
"which is not compatible with this version %s.",
|
||||
file_major, file_minor, version_string)));
|
||||
file_version_string, my_version_string)));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user