Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2cb4b8e

Browse files
committed
pg_upgrade; change major version comparisons to use <=, not <
This makes checking for older major versions more consistent. Backpatch-through: 9.5
1 parent b7f166e commit 2cb4b8e

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

src/bin/pg_upgrade/check.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ check_cluster_versions(void)
267267
* upgrades
268268
*/
269269

270-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
270+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
271271
pg_fatal("This utility can only upgrade from PostgreSQL version 8.4 and later.\n");
272272

273273
/* Only current PG version is supported as a target */
@@ -304,7 +304,7 @@ check_cluster_compatibility(bool live_check)
304304
check_control_data(&old_cluster.controldata, &new_cluster.controldata);
305305

306306
/* We read the real port number for PG >= 9.1 */
307-
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
307+
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
308308
old_cluster.port == DEF_PGUPORT)
309309
pg_fatal("When checking a pre-PG 9.1 live old server, "
310310
"you must specify the old server's port number.\n");
@@ -512,7 +512,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
512512
fprintf(script, "\"%s/vacuumdb\" %s--all --analyze-in-stages\n",
513513
new_cluster.bindir, user_specification.data);
514514
/* Did we copy the free space files? */
515-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
515+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
516516
fprintf(script, "\"%s/vacuumdb\" %s--all\n", new_cluster.bindir,
517517
user_specification.data);
518518

src/bin/pg_upgrade/controldata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
180180
}
181181

182182
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
183-
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
183+
if (GET_MAJOR_VERSION(cluster->bin_version) <= 906)
184184
resetwal_bin = "pg_resetxlog\" -n";
185185
else
186186
resetwal_bin = "pg_resetwal\" -n";

src/bin/pg_upgrade/exec.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ check_data_dir(ClusterInfo *cluster)
341341
check_single_dir(pg_data, "pg_twophase");
342342

343343
/* pg_xlog has been renamed to pg_wal in v10 */
344-
if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
344+
if (GET_MAJOR_VERSION(cluster->major_version) <= 906)
345345
check_single_dir(pg_data, "pg_xlog");
346346
else
347347
check_single_dir(pg_data, "pg_wal");
348348

349349
/* pg_clog has been renamed to pg_xact in v10 */
350-
if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
350+
if (GET_MAJOR_VERSION(cluster->major_version) <= 906)
351351
check_single_dir(pg_data, "pg_clog");
352352
else
353353
check_single_dir(pg_data, "pg_xact");
@@ -387,7 +387,7 @@ check_bin_dir(ClusterInfo *cluster)
387387
get_bin_version(cluster);
388388

389389
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
390-
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
390+
if (GET_MAJOR_VERSION(cluster->bin_version) <= 906)
391391
validate_exec(cluster->bindir, "pg_resetxlog");
392392
else
393393
validate_exec(cluster->bindir, "pg_resetwal");

src/bin/pg_upgrade/function.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ get_loadable_libraries(void)
9090
* http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
9191
* http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
9292
*/
93-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901)
93+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900)
9494
{
9595
PGresult *res;
9696

@@ -218,7 +218,7 @@ check_loadable_libraries(void)
218218
* library name "plpython" in an old PG <= 9.1 cluster must look
219219
* for "plpython2" in the new cluster.
220220
*/
221-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
221+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
222222
strcmp(lib, "$libdir/plpython") == 0)
223223
{
224224
lib = "$libdir/plpython2";

src/bin/pg_upgrade/pg_upgrade.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ create_new_objects(void)
407407
* We don't have minmxids for databases or relations in pre-9.3 clusters,
408408
* so set those after we have restored the schema.
409409
*/
410-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 903)
410+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 902)
411411
set_frozenxids(true);
412412

413413
/* update new_cluster info now that we have objects in the databases */
@@ -466,9 +466,9 @@ copy_xact_xlog_xid(void)
466466
* Copy old commit logs to new data dir. pg_clog has been renamed to
467467
* pg_xact in post-10 clusters.
468468
*/
469-
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
469+
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) <= 906 ?
470470
"pg_clog" : "pg_xact",
471-
GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
471+
GET_MAJOR_VERSION(new_cluster.major_version) <= 906 ?
472472
"pg_clog" : "pg_xact");
473473

474474
/* set the next transaction id and epoch of the new cluster */

src/bin/pg_upgrade/server.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
220220
snprintf(socket_string + strlen(socket_string),
221221
sizeof(socket_string) - strlen(socket_string),
222222
" -c %s='%s'",
223-
(GET_MAJOR_VERSION(cluster->major_version) < 903) ?
223+
(GET_MAJOR_VERSION(cluster->major_version) <= 902) ?
224224
"unix_socket_directory" : "unix_socket_directories",
225225
cluster->sockdir);
226226
#endif

0 commit comments

Comments
 (0)