Commit 0829c708 authored by Andrew Dunstan's avatar Andrew Dunstan

Fix command echoing in pg_upgade's analyze script for Windows.

parent bd46b521
...@@ -450,6 +450,9 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -450,6 +450,9 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
#ifndef WIN32 #ifndef WIN32
/* add shebang header */ /* add shebang header */
fprintf(script, "#!/bin/sh\n\n"); fprintf(script, "#!/bin/sh\n\n");
#else
/* suppress command echoing */
fprintf(script, "@echo off");
#endif #endif
fprintf(script, "echo %sThis script will generate minimal optimizer statistics rapidly%s\n", fprintf(script, "echo %sThis script will generate minimal optimizer statistics rapidly%s\n",
...@@ -460,7 +463,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -460,7 +463,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "echo %shave the default level of optimizer statistics.%s\n", fprintf(script, "echo %shave the default level of optimizer statistics.%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "echo\n\n"); fprintf(script, "echo%s\n\n", ECHO_BLANK);
fprintf(script, "echo %sIf you have used ALTER TABLE to modify the statistics target for%s\n", fprintf(script, "echo %sIf you have used ALTER TABLE to modify the statistics target for%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
...@@ -468,7 +471,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -468,7 +471,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "echo %srunning this script because they will delay fast statistics generation.%s\n", fprintf(script, "echo %srunning this script because they will delay fast statistics generation.%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "echo\n\n"); fprintf(script, "echo%s\n\n", ECHO_BLANK);
fprintf(script, "echo %sIf you would like default statistics as quickly as possible, cancel%s\n", fprintf(script, "echo %sIf you would like default statistics as quickly as possible, cancel%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
...@@ -478,7 +481,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -478,7 +481,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
/* Did we copy the free space files? */ /* Did we copy the free space files? */
(GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ? (GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
"--analyze-only" : "--analyze", ECHO_QUOTE); "--analyze-only" : "--analyze", ECHO_QUOTE);
fprintf(script, "echo\n\n"); fprintf(script, "echo%s\n\n", ECHO_BLANK);
#ifndef WIN32 #ifndef WIN32
fprintf(script, "sleep 2\n"); fprintf(script, "sleep 2\n");
...@@ -496,12 +499,12 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -496,12 +499,12 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
fprintf(script, "echo %s--------------------------------------------------%s\n", fprintf(script, "echo %s--------------------------------------------------%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "vacuumdb --all --analyze-only\n"); fprintf(script, "vacuumdb --all --analyze-only\n");
fprintf(script, "echo\n"); fprintf(script, "echo%s\n", ECHO_BLANK);
fprintf(script, "echo %sThe server is now available with minimal optimizer statistics.%s\n", fprintf(script, "echo %sThe server is now available with minimal optimizer statistics.%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "echo %sQuery performance will be optimal once this script completes.%s\n", fprintf(script, "echo %sQuery performance will be optimal once this script completes.%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "echo\n\n"); fprintf(script, "echo%s\n\n", ECHO_BLANK);
#ifndef WIN32 #ifndef WIN32
fprintf(script, "sleep 2\n"); fprintf(script, "sleep 2\n");
...@@ -517,7 +520,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -517,7 +520,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
fprintf(script, "echo %s---------------------------------------------------%s\n", fprintf(script, "echo %s---------------------------------------------------%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
fprintf(script, "vacuumdb --all --analyze-only\n"); fprintf(script, "vacuumdb --all --analyze-only\n");
fprintf(script, "echo\n\n"); fprintf(script, "echo%s\n\n", ECHO_BLANK);
#ifndef WIN32 #ifndef WIN32
fprintf(script, "unset PGOPTIONS\n"); fprintf(script, "unset PGOPTIONS\n");
...@@ -534,7 +537,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name) ...@@ -534,7 +537,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
(GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ? (GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
"--analyze-only" : "--analyze"); "--analyze-only" : "--analyze");
fprintf(script, "echo\n\n"); fprintf(script, "echo%s\n\n", ECHO_BLANK);
fprintf(script, "echo %sDone%s\n", fprintf(script, "echo %sDone%s\n",
ECHO_QUOTE, ECHO_QUOTE); ECHO_QUOTE, ECHO_QUOTE);
......
...@@ -77,6 +77,7 @@ extern char *output_files[]; ...@@ -77,6 +77,7 @@ extern char *output_files[];
#define RMDIR_CMD "rm -rf" #define RMDIR_CMD "rm -rf"
#define SCRIPT_EXT "sh" #define SCRIPT_EXT "sh"
#define ECHO_QUOTE "'" #define ECHO_QUOTE "'"
#define ECHO_BLANK ""
#else #else
#define pg_copy_file CopyFile #define pg_copy_file CopyFile
#define pg_mv_file pgrename #define pg_mv_file pgrename
...@@ -88,6 +89,7 @@ extern char *output_files[]; ...@@ -88,6 +89,7 @@ extern char *output_files[];
#define SCRIPT_EXT "bat" #define SCRIPT_EXT "bat"
#define EXE_EXT ".exe" #define EXE_EXT ".exe"
#define ECHO_QUOTE "" #define ECHO_QUOTE ""
#define ECHO_BLANK "."
#endif #endif
#define CLUSTER_NAME(cluster) ((cluster) == &old_cluster ? "old" : \ #define CLUSTER_NAME(cluster) ((cluster) == &old_cluster ? "old" : \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment