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

Commit bc1fbc9

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 d7885b1 commit bc1fbc9

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
@@ -275,7 +275,7 @@ check_cluster_versions(void)
275275
* upgrades
276276
*/
277277

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

281281
/* Only current PG version is supported as a target */
@@ -312,7 +312,7 @@ check_cluster_compatibility(bool live_check)
312312
check_control_data(&old_cluster.controldata, &new_cluster.controldata);
313313

314314
/* We read the real port number for PG >= 9.1 */
315-
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
315+
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
316316
old_cluster.port == DEF_PGUPORT)
317317
pg_fatal("When checking a pre-PG 9.1 live old server, "
318318
"you must specify the old server's port number.\n");
@@ -520,7 +520,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
520520
fprintf(script, "\"%s/vacuumdb\" %s--all --analyze-in-stages\n",
521521
new_cluster.bindir, user_specification.data);
522522
/* Did we copy the free space files? */
523-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
523+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
524524
fprintf(script, "\"%s/vacuumdb\" %s--all\n", new_cluster.bindir,
525525
user_specification.data);
526526

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)