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

Commit dc39534

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 3d69efc commit dc39534

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
@@ -268,7 +268,7 @@ check_cluster_versions(void)
268268
* upgrades
269269
*/
270270

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

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

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

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");
@@ -386,7 +386,7 @@ check_bin_dir(ClusterInfo *cluster)
386386
get_bin_version(cluster);
387387

388388
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
389-
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
389+
if (GET_MAJOR_VERSION(cluster->bin_version) <= 906)
390390
validate_exec(cluster->bindir, "pg_resetxlog");
391391
else
392392
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
@@ -92,7 +92,7 @@ get_loadable_libraries(void)
9292
* http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
9393
* http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
9494
*/
95-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901)
95+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900)
9696
{
9797
PGresult *res;
9898

@@ -224,7 +224,7 @@ check_loadable_libraries(void)
224224
* works for languages, and does not help with function shared
225225
* objects, so we just do a general fix.
226226
*/
227-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
227+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
228228
strcmp(lib, "$libdir/plpython") == 0)
229229
{
230230
lib = "$libdir/plpython2";

src/bin/pg_upgrade/pg_upgrade.c

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

412412
/* update new_cluster info now that we have objects in the databases */
@@ -465,9 +465,9 @@ copy_xact_xlog_xid(void)
465465
* Copy old commit logs to new data dir. pg_clog has been renamed to
466466
* pg_xact in post-10 clusters.
467467
*/
468-
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
468+
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) <= 906 ?
469469
"pg_clog" : "pg_xact",
470-
GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
470+
GET_MAJOR_VERSION(new_cluster.major_version) <= 906 ?
471471
"pg_clog" : "pg_xact");
472472

473473
/* 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
@@ -221,7 +221,7 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
221221
snprintf(socket_string + strlen(socket_string),
222222
sizeof(socket_string) - strlen(socket_string),
223223
" -c %s='%s'",
224-
(GET_MAJOR_VERSION(cluster->major_version) < 903) ?
224+
(GET_MAJOR_VERSION(cluster->major_version) <= 902) ?
225225
"unix_socket_directory" : "unix_socket_directories",
226226
cluster->sockdir);
227227
#endif

0 commit comments

Comments
 (0)