Skip to content

Commit f09e2a8

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 9e2c53d commit f09e2a8

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
@@ -243,7 +243,7 @@ check_cluster_versions(void)
243243
* upgrades
244244
*/
245245

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

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

282282
/* We read the real port number for PG >= 9.1 */
283-
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
283+
if (live_check && GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
284284
old_cluster.port == DEF_PGUPORT)
285285
pg_fatal("When checking a pre-PG 9.1 live old server, "
286286
"you must specify the old server's port number.\n");
@@ -486,7 +486,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
486486
fprintf(script, "\"%s/vacuumdb\" %s--all --analyze-in-stages\n",
487487
new_cluster.bindir, user_specification.data);
488488
/* Did we copy the free space files? */
489-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 804)
489+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 803)
490490
fprintf(script, "\"%s/vacuumdb\" %s--all\n", new_cluster.bindir,
491491
user_specification.data);
492492

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
@@ -339,13 +339,13 @@ check_data_dir(ClusterInfo *cluster)
339339
check_single_dir(pg_data, "pg_twophase");
340340

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

347347
/* pg_clog has been renamed to pg_xact in v10 */
348-
if (GET_MAJOR_VERSION(cluster->major_version) < 1000)
348+
if (GET_MAJOR_VERSION(cluster->major_version) <= 906)
349349
check_single_dir(pg_data, "pg_clog");
350350
else
351351
check_single_dir(pg_data, "pg_xact");
@@ -384,7 +384,7 @@ check_bin_dir(ClusterInfo *cluster)
384384
get_bin_version(cluster);
385385

386386
/* pg_resetxlog has been renamed to pg_resetwal in version 10 */
387-
if (GET_MAJOR_VERSION(cluster->bin_version) < 1000)
387+
if (GET_MAJOR_VERSION(cluster->bin_version) <= 906)
388388
validate_exec(cluster->bindir, "pg_resetxlog");
389389
else
390390
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
@@ -86,7 +86,7 @@ get_loadable_libraries(void)
8686
* http://archives.postgresql.org/pgsql-hackers/2012-03/msg01101.php
8787
* http://archives.postgresql.org/pgsql-bugs/2012-05/msg00206.php
8888
*/
89-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901)
89+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900)
9090
{
9191
PGresult *res;
9292

@@ -232,7 +232,7 @@ check_loadable_libraries(void)
232232
* for languages, and does not help with function shared objects, so
233233
* we just do a general fix.
234234
*/
235-
if (GET_MAJOR_VERSION(old_cluster.major_version) < 901 &&
235+
if (GET_MAJOR_VERSION(old_cluster.major_version) <= 900 &&
236236
strcmp(lib, "$libdir/plpython") == 0)
237237
{
238238
lib = "$libdir/plpython2";

src/bin/pg_upgrade/pg_upgrade.c

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

363363
/* regenerate now that we have objects in the databases */
@@ -416,9 +416,9 @@ copy_xact_xlog_xid(void)
416416
* Copy old commit logs to new data dir. pg_clog has been renamed to
417417
* pg_xact in post-10 clusters.
418418
*/
419-
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) < 1000 ?
419+
copy_subdir_files(GET_MAJOR_VERSION(old_cluster.major_version) <= 906 ?
420420
"pg_clog" : "pg_xact",
421-
GET_MAJOR_VERSION(new_cluster.major_version) < 1000 ?
421+
GET_MAJOR_VERSION(new_cluster.major_version) <= 906 ?
422422
"pg_clog" : "pg_xact");
423423

424424
/* 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)