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

Commit 0829c70

Browse files
committed
Fix command echoing in pg_upgade's analyze script for Windows.
1 parent bd46b52 commit 0829c70

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

contrib/pg_upgrade/check.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,9 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
450450
#ifndef WIN32
451451
/* add shebang header */
452452
fprintf(script, "#!/bin/sh\n\n");
453+
#else
454+
/* suppress command echoing */
455+
fprintf(script, "@echo off");
453456
#endif
454457

455458
fprintf(script, "echo %sThis script will generate minimal optimizer statistics rapidly%s\n",
@@ -460,15 +463,15 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
460463
ECHO_QUOTE, ECHO_QUOTE);
461464
fprintf(script, "echo %shave the default level of optimizer statistics.%s\n",
462465
ECHO_QUOTE, ECHO_QUOTE);
463-
fprintf(script, "echo\n\n");
466+
fprintf(script, "echo%s\n\n", ECHO_BLANK);
464467

465468
fprintf(script, "echo %sIf you have used ALTER TABLE to modify the statistics target for%s\n",
466469
ECHO_QUOTE, ECHO_QUOTE);
467470
fprintf(script, "echo %sany tables, you might want to remove them and restore them after%s\n",
468471
ECHO_QUOTE, ECHO_QUOTE);
469472
fprintf(script, "echo %srunning this script because they will delay fast statistics generation.%s\n",
470473
ECHO_QUOTE, ECHO_QUOTE);
471-
fprintf(script, "echo\n\n");
474+
fprintf(script, "echo%s\n\n", ECHO_BLANK);
472475

473476
fprintf(script, "echo %sIf you would like default statistics as quickly as possible, cancel%s\n",
474477
ECHO_QUOTE, ECHO_QUOTE);
@@ -478,7 +481,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
478481
/* Did we copy the free space files? */
479482
(GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
480483
"--analyze-only" : "--analyze", ECHO_QUOTE);
481-
fprintf(script, "echo\n\n");
484+
fprintf(script, "echo%s\n\n", ECHO_BLANK);
482485

483486
#ifndef WIN32
484487
fprintf(script, "sleep 2\n");
@@ -496,12 +499,12 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
496499
fprintf(script, "echo %s--------------------------------------------------%s\n",
497500
ECHO_QUOTE, ECHO_QUOTE);
498501
fprintf(script, "vacuumdb --all --analyze-only\n");
499-
fprintf(script, "echo\n");
502+
fprintf(script, "echo%s\n", ECHO_BLANK);
500503
fprintf(script, "echo %sThe server is now available with minimal optimizer statistics.%s\n",
501504
ECHO_QUOTE, ECHO_QUOTE);
502505
fprintf(script, "echo %sQuery performance will be optimal once this script completes.%s\n",
503506
ECHO_QUOTE, ECHO_QUOTE);
504-
fprintf(script, "echo\n\n");
507+
fprintf(script, "echo%s\n\n", ECHO_BLANK);
505508

506509
#ifndef WIN32
507510
fprintf(script, "sleep 2\n");
@@ -517,7 +520,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
517520
fprintf(script, "echo %s---------------------------------------------------%s\n",
518521
ECHO_QUOTE, ECHO_QUOTE);
519522
fprintf(script, "vacuumdb --all --analyze-only\n");
520-
fprintf(script, "echo\n\n");
523+
fprintf(script, "echo%s\n\n", ECHO_BLANK);
521524

522525
#ifndef WIN32
523526
fprintf(script, "unset PGOPTIONS\n");
@@ -534,7 +537,7 @@ create_script_for_cluster_analyze(char **analyze_script_file_name)
534537
(GET_MAJOR_VERSION(old_cluster.major_version) >= 804) ?
535538
"--analyze-only" : "--analyze");
536539

537-
fprintf(script, "echo\n\n");
540+
fprintf(script, "echo%s\n\n", ECHO_BLANK);
538541
fprintf(script, "echo %sDone%s\n",
539542
ECHO_QUOTE, ECHO_QUOTE);
540543

contrib/pg_upgrade/pg_upgrade.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ extern char *output_files[];
7777
#define RMDIR_CMD "rm -rf"
7878
#define SCRIPT_EXT "sh"
7979
#define ECHO_QUOTE "'"
80+
#define ECHO_BLANK ""
8081
#else
8182
#define pg_copy_file CopyFile
8283
#define pg_mv_file pgrename
@@ -88,6 +89,7 @@ extern char *output_files[];
8889
#define SCRIPT_EXT "bat"
8990
#define EXE_EXT ".exe"
9091
#define ECHO_QUOTE ""
92+
#define ECHO_BLANK "."
9193
#endif
9294

9395
#define CLUSTER_NAME(cluster) ((cluster) == &old_cluster ? "old" : \

0 commit comments

Comments
 (0)