diff --git a/src/command/restore/restore.c b/src/command/restore/restore.c index dc068a908..bda49178f 100644 --- a/src/command/restore/restore.c +++ b/src/command/restore/restore.c @@ -1581,7 +1581,7 @@ restoreRecoveryOption(unsigned int pgVersion) { THROW_FMT( OptionInvalidError, - "option '" CFGOPT_ARCHIVE_MODE "' is not supported on " PG_NAME " < " PG_VERSION_12_STR "\n" + "option '" CFGOPT_ARCHIVE_MODE "' is not supported on " PG_NAME " < " PG_VERSION_12_Z "\n" "HINT: 'archive_mode' should be manually set to 'off' in postgresql.conf."); } diff --git a/src/db/db.c b/src/db/db.c index ac8653e5f..3e014ebcb 100644 --- a/src/db/db.c +++ b/src/db/db.c @@ -284,7 +284,7 @@ dbOpen(Db *this) DbQueryError, "unable to select some rows from pg_settings\n" "HINT: is the backup running as the postgres user?\n" - "HINT: is the pg_read_all_settings role assigned for " PG_NAME " >= " PG_VERSION_10_STR "?"); + "HINT: is the pg_read_all_settings role assigned for " PG_NAME " >= " PG_VERSION_10_Z "?"); } } diff --git a/src/postgres/interface.c b/src/postgres/interface.c index cb262a832..bb93e2cf0 100644 --- a/src/postgres/interface.c +++ b/src/postgres/interface.c @@ -169,7 +169,7 @@ pgWalSegmentSizeCheck(unsigned int pgVersion, unsigned int walSegmentSize) if (pgVersion < PG_VERSION_11 && walSegmentSize != PG_WAL_SEGMENT_SIZE_DEFAULT) { THROW_FMT( - FormatError, "wal segment size is %u but must be %u for " PG_NAME " <= " PG_VERSION_10_STR, walSegmentSize, + FormatError, "wal segment size is %u but must be %u for " PG_NAME " <= " PG_VERSION_10_Z, walSegmentSize, PG_WAL_SEGMENT_SIZE_DEFAULT); } diff --git a/src/postgres/version.h b/src/postgres/version.h index 08f03ebe0..23c7f8a22 100644 --- a/src/postgres/version.h +++ b/src/postgres/version.h @@ -46,15 +46,15 @@ Version where various PostgreSQL capabilities were introduced /*********************************************************************************************************************************** PostgreSQL version string constants for use in error messages ***********************************************************************************************************************************/ -#define PG_VERSION_93_STR "9.3" -#define PG_VERSION_94_STR "9.4" -#define PG_VERSION_95_STR "9.5" -#define PG_VERSION_96_STR "9.6" -#define PG_VERSION_10_STR "10" -#define PG_VERSION_11_STR "11" -#define PG_VERSION_12_STR "12" -#define PG_VERSION_13_STR "13" -#define PG_VERSION_14_STR "14" -#define PG_VERSION_15_STR "15" +#define PG_VERSION_93_Z "9.3" +#define PG_VERSION_94_Z "9.4" +#define PG_VERSION_95_Z "9.5" +#define PG_VERSION_96_Z "9.6" +#define PG_VERSION_10_Z "10" +#define PG_VERSION_11_Z "11" +#define PG_VERSION_12_Z "12" +#define PG_VERSION_13_Z "13" +#define PG_VERSION_14_Z "14" +#define PG_VERSION_15_Z "15" #endif diff --git a/test/src/module/command/backupTest.c b/test/src/module/command/backupTest.c index 4baea1024..511aea81d 100644 --- a/test/src/module/command/backupTest.c +++ b/test/src/module/command/backupTest.c @@ -2421,7 +2421,7 @@ testRun(void) // Add files HRN_STORAGE_PUT_Z(storagePgWrite(), "postgresql.conf", "CONFIGSTUFF", .timeModified = backupTimeStart); - HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_95_STR, .timeModified = backupTimeStart); + HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_95_Z, .timeModified = backupTimeStart); HRN_STORAGE_PATH_CREATE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_95)), .noParentCreate = true); // Create a backup manifest that looks like a halted backup manifest @@ -2871,7 +2871,7 @@ testRun(void) HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_96); // Update version - HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_96_STR, .timeModified = backupTimeStart); + HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_96_Z, .timeModified = backupTimeStart); // Upgrade stanza StringList *argList = strLstNew(); @@ -3029,7 +3029,7 @@ testRun(void) HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_11, .pageChecksum = true, .walSegmentSize = 1024 * 1024); // Update version - HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_STR, .timeModified = backupTimeStart); + HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_Z, .timeModified = backupTimeStart); // Update wal path HRN_STORAGE_PATH_REMOVE(storagePgWrite(), strZ(pgWalPath(PG_VERSION_95))); @@ -3551,7 +3551,7 @@ testRun(void) HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_11, .pageChecksum = false, .walSegmentSize = 2 * 1024 * 1024); // Update version - HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_STR, .timeModified = backupTimeStart); + HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_Z, .timeModified = backupTimeStart); // Load options StringList *argList = strLstNew(); @@ -3638,7 +3638,7 @@ testRun(void) HRN_PG_CONTROL_PUT(storagePgWrite(), PG_VERSION_11, .pageChecksum = false, .walSegmentSize = 2 * 1024 * 1024); // Update version - HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_STR, .timeModified = backupTimeStart); + HRN_STORAGE_PUT_Z(storagePgWrite(), PG_FILE_PGVERSION, PG_VERSION_11_Z, .timeModified = backupTimeStart); // Load options StringList *argList = strLstNew(); diff --git a/test/src/module/command/checkTest.c b/test/src/module/command/checkTest.c index 8ec0b5699..8cdaf92ac 100644 --- a/test/src/module/command/checkTest.c +++ b/test/src/module/command/checkTest.c @@ -183,8 +183,8 @@ testRun(void) TEST_ERROR( cmdCheck(), DbMismatchError, - "version '" PG_VERSION_15_STR "' and path '" TEST_PATH "' queried from cluster do not match version" - " '" PG_VERSION_15_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n" + "version '" PG_VERSION_15_Z "' and path '" TEST_PATH "' queried from cluster do not match version '" PG_VERSION_15_Z + "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n" "HINT: the pg1-path and pg1-port settings likely reference different clusters."); // ------------------------------------------------------------------------------------------------------------------------- @@ -421,8 +421,8 @@ testRun(void) TEST_ERROR( checkDbConfig(PG_VERSION_94, db.primaryIdx, db.primary, false), DbMismatchError, - "version '" PG_VERSION_11_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '" - PG_VERSION_94_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n" + "version '" PG_VERSION_11_Z "' and path '" TEST_PATH "/pg' queried from cluster do not match version '" + PG_VERSION_94_Z "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/global/pg_control'\n" "HINT: the pg1-path and pg1-port settings likely reference different clusters."); // ------------------------------------------------------------------------------------------------------------------------- @@ -430,7 +430,7 @@ testRun(void) TEST_ERROR_FMT( checkDbConfig(PG_VERSION_11, db.standbyIdx, db.standby, true), DbMismatchError, - "version '" PG_VERSION_11_STR "' and path '%s' queried from cluster do not match version '" PG_VERSION_11_STR "' and" + "version '" PG_VERSION_11_Z "' and path '%s' queried from cluster do not match version '" PG_VERSION_11_Z "' and" " '" TEST_PATH "/pg8' read from '" TEST_PATH "/pg8/global/pg_control'\n" "HINT: the pg8-path and pg8-port settings likely reference different clusters.", strZ(dbPgDataPath(db.standby))); diff --git a/test/src/module/command/manifestTest.c b/test/src/module/command/manifestTest.c index 26093dbc1..17d9c3e90 100644 --- a/test/src/module/command/manifestTest.c +++ b/test/src/module/command/manifestTest.c @@ -81,7 +81,7 @@ testRun(void) // Version file that will not be updated after the full backup HRN_STORAGE_PUT_Z( - storagePgWrite(), PG_PATH_BASE "/" PG_FILE_PGVERSION, PG_VERSION_95_STR, .timeModified = backupTimeStart); + storagePgWrite(), PG_PATH_BASE "/" PG_FILE_PGVERSION, PG_VERSION_95_Z, .timeModified = backupTimeStart); // Zeroed file large enough to use block incr Buffer *relation = bufNew(8 * 8192); diff --git a/test/src/module/command/restoreTest.c b/test/src/module/command/restoreTest.c index 86b8c4746..9b2c78bf8 100644 --- a/test/src/module/command/restoreTest.c +++ b/test/src/module/command/restoreTest.c @@ -2121,11 +2121,11 @@ testRun(void) HRN_MANIFEST_FILE_ADD( manifest, .name = TEST_PGDATA PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860, .checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"); - HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_STR "\n"); + HRN_STORAGE_PUT_Z(storageRepoIdxWrite(0), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_Z "\n"); // Store the file also to the encrypted repo HRN_STORAGE_PUT_Z( - storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_STR "\n", + storageRepoIdxWrite(1), TEST_REPO_PATH PG_FILE_PGVERSION, PG_VERSION_94_Z "\n", .cipherType = cipherTypeAes256Cbc, .cipherPass = TEST_CIPHER_PASS_ARCHIVE); // pg_tblspc @@ -2292,7 +2292,7 @@ testRun(void) HRN_STORAGE_PUT_Z( storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_LABEL "/" MANIFEST_TARGET_PGTBLSPC "/1/16384/" PG_FILE_PGVERSION, - PG_VERSION_94_STR "\n"); + PG_VERSION_94_Z "\n"); // Always sort lstSort(manifest->pub.targetList, sortOrderAsc); @@ -2439,7 +2439,7 @@ testRun(void) .level = storageInfoLevelBasic, .includeDot = true); // PG_VERSION was restored by the force option - TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_94_STR "\n", .comment = "check PG_VERSION was restored"); + TEST_STORAGE_GET(storagePg(), PG_FILE_PGVERSION, PG_VERSION_94_Z "\n", .comment = "check PG_VERSION was restored"); // Remove tablespace HRN_STORAGE_PATH_REMOVE(storagePgWrite(), MANIFEST_TARGET_PGTBLSPC "/1/PG_9.4_201409291", .recurse = true); @@ -2538,7 +2538,7 @@ testRun(void) .bundleId = 1, .bundleOffset = 17, .checksumSha1 = "d7dacae2c968388960bf8970080a980ed5c5dcb7"); HRN_STORAGE_PUT_Z( storageRepoWrite(), STORAGE_REPO_BACKUP "/" TEST_LABEL "/bundle/1", - PG_VERSION_96_STR "\n" PG_VERSION_96_STR "\nyyyxxxxxAzzA"); + PG_VERSION_96_Z "\n" PG_VERSION_96_Z "\nyyyxxxxxAzzA"); // base directory HRN_MANIFEST_PATH_ADD(manifest, .name = TEST_PGDATA PG_PATH_BASE); @@ -2603,7 +2603,7 @@ testRun(void) HRN_MANIFEST_FILE_ADD( manifest, .name = TEST_PGDATA "base/16384/" PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860, .checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"); - HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/16384/" PG_FILE_PGVERSION, PG_VERSION_94_STR "\n"); + HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/16384/" PG_FILE_PGVERSION, PG_VERSION_94_Z "\n"); // base/16384/16385 fileBuffer = bufNew(16384); @@ -2623,7 +2623,7 @@ testRun(void) HRN_MANIFEST_FILE_ADD( manifest, .name = TEST_PGDATA "base/32768/" PG_FILE_PGVERSION, .size = 4, .timestamp = 1482182860, .checksumSha1 = "8dbabb96e032b8d9f1993c0e4b9141e71ade01a1"); - HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/32768/" PG_FILE_PGVERSION, PG_VERSION_94_STR "\n"); + HRN_STORAGE_PUT_Z(storageRepoWrite(), TEST_REPO_PATH "base/32768/" PG_FILE_PGVERSION, PG_VERSION_94_Z "\n"); // base/32768/32769 fileBuffer = bufNew(32768); @@ -2946,7 +2946,7 @@ testRun(void) // Enlarge a file so it gets truncated. Keep timestamp the same to prove that it gets updated after the truncate. HRN_STORAGE_PUT_Z( - storagePgWrite(), "base/16384/" PG_FILE_PGVERSION, PG_VERSION_94_STR "\n\n", .modeFile = 0600, + storagePgWrite(), "base/16384/" PG_FILE_PGVERSION, PG_VERSION_94_Z "\n\n", .modeFile = 0600, .timeModified = 1482182860); // Enlarge a zero-length file so it gets truncated diff --git a/test/src/module/command/stanzaTest.c b/test/src/module/command/stanzaTest.c index 52a75c0d1..fa73e4f07 100644 --- a/test/src/module/command/stanzaTest.c +++ b/test/src/module/command/stanzaTest.c @@ -611,8 +611,8 @@ testRun(void) TEST_ERROR( pgValidate(), DbMismatchError, - "version '" PG_VERSION_11_STR "' and path '" TEST_PATH "/pg' queried from cluster do not match version '" - PG_VERSION_10_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n" + "version '" PG_VERSION_11_Z "' and path '" TEST_PATH "/pg' queried from cluster do not match version '" PG_VERSION_10_Z + "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n" "HINT: the pg1-path and pg1-port settings likely reference different clusters."); // ------------------------------------------------------------------------------------------------------------------------- @@ -629,9 +629,8 @@ testRun(void) TEST_ERROR( pgValidate(), DbMismatchError, - "version '" PG_VERSION_15_STR "' and path '" TEST_PATH "/pg2' queried from cluster do not match version" - " '" PG_VERSION_15_STR "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL - "/" PG_FILE_PGCONTROL "'\n" + "version '" PG_VERSION_15_Z "' and path '" TEST_PATH "/pg2' queried from cluster do not match version '" PG_VERSION_15_Z + "' and '" TEST_PATH "/pg' read from '" TEST_PATH "/pg/" PG_PATH_GLOBAL "/" PG_FILE_PGCONTROL "'\n" "HINT: the pg1-path and pg1-port settings likely reference different clusters."); // ------------------------------------------------------------------------------------------------------------------------- diff --git a/test/src/module/command/verifyTest.c b/test/src/module/command/verifyTest.c index 7fb393ada..6d5da2504 100644 --- a/test/src/module/command/verifyTest.c +++ b/test/src/module/command/verifyTest.c @@ -1824,7 +1824,7 @@ testRun(void) TEST_TITLE("none output, verbose, override WAL magic, with no verify failures"); hrnCfgArgRawZ(argList, cfgOptVerbose, "y"); - hrnCfgArgRawZ(argList, cfgOptPgVersionForce, PG_VERSION_11_STR); + hrnCfgArgRawZ(argList, cfgOptPgVersionForce, PG_VERSION_11_Z); HRN_CFG_LOAD(cfgCmdVerify, argList); TEST_RESULT_STR_Z( verifyProcess(cfgOptionBool(cfgOptVerbose)), diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c index 1ffdc6bd5..e6b568273 100644 --- a/test/src/module/postgres/interfaceTest.c +++ b/test/src/module/postgres/interfaceTest.c @@ -127,7 +127,7 @@ testRun(void) "invalid PostgreSQL version 990000\n" "HINT: is this version of PostgreSQL supported?"); - TEST_ASSIGN(info, pgControlFromFile(storageTest, STRDEF(PG_VERSION_15_STR)), "get control info v90"); + TEST_ASSIGN(info, pgControlFromFile(storageTest, STRDEF(PG_VERSION_15_Z)), "get control info v90"); TEST_RESULT_UINT(info.systemId, 0xEFEFEFEFEF, "check system id"); TEST_RESULT_UINT(info.version, PG_VERSION_15, "check version"); TEST_RESULT_UINT(info.catalogVersion, 202211111, "check catalog version"); @@ -265,7 +265,7 @@ testRun(void) "unexpected WAL magic 777\n" "HINT: is this version of PostgreSQL supported?"); - TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, STRDEF(PG_VERSION_15_STR)), "force wal info v15"); + TEST_ASSIGN(info, pgWalFromFile(walFile, storageTest, STRDEF(PG_VERSION_15_Z)), "force wal info v15"); TEST_RESULT_UINT(info.systemId, 0xFAFAFAFA, "check system id"); TEST_RESULT_UINT(info.version, PG_VERSION_15, " check version"); TEST_RESULT_UINT(info.size, PG_WAL_SEGMENT_SIZE_DEFAULT, " check size");