From 541d5b3355c9d561faa818eb5baef586d30c5ce7 Mon Sep 17 00:00:00 2001 From: chenxiaobin <1025221611@qq.com> Date: Sat, 30 Jan 2021 10:44:05 +0800 Subject: [PATCH 1/2] modify gs_ctl --help information --- src/bin/pg_ctl/pg_ctl.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_ctl/pg_ctl.cpp b/src/bin/pg_ctl/pg_ctl.cpp index c52d60b85..2ad3741c7 100644 --- a/src/bin/pg_ctl/pg_ctl.cpp +++ b/src/bin/pg_ctl/pg_ctl.cpp @@ -3463,7 +3463,7 @@ static void do_help(void) printf(_(" %s restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n" " [-o \"OPTIONS\"]\n"), progname); - printf(_(" %s build [-D DATADIR] [-r SECS] [-q]\n"), progname); + printf(_(" %s build [-D DATADIR] [-b MODE] [-r SECS] [-q] [-M SERVERMODE]\n"), progname); #endif printf(_(" %s stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"), progname); @@ -3489,7 +3489,8 @@ static void do_help(void) (void)printf(_(" %s hotpatch [-D DATADIR] [-a ACTION] [-n NAME]\n"), progname); #endif printf(_("\nCommon options:\n")); - printf(_(" -b, --mode=MODE the mode of building the datanode.MODE can be \"full\", \"incremental\"\n")); + printf(_(" -b, --mode=MODE the mode of building the datanode.MODE can be \"full\", \"incremental\", " + "\"auto\"\n")); printf(_(" -D, --pgdata=DATADIR location of the database storage area\n")); printf(_(" -s, --silent only print errors, no informational messages\n")); printf(_(" -t, --timeout=SECS seconds to wait when using -w option\n")); From 918ecfe9b0c042c97f5d524eb38b1cf6102c3ff0 Mon Sep 17 00:00:00 2001 From: chenxiaobin <1025221611@qq.com> Date: Fri, 29 Jan 2021 17:56:40 +0800 Subject: [PATCH 2/2] fix gsql core bug when running '\e' --- src/bin/psql/command.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/bin/psql/command.cpp b/src/bin/psql/command.cpp index bdfe9eca7..512b0b1c2 100644 --- a/src/bin/psql/command.cpp +++ b/src/bin/psql/command.cpp @@ -1870,22 +1870,23 @@ static bool editFile(const char* fname, int lineno) return false; } check_env_value(editor_lineno_arg); - } - if (strlen(editor_lineno_arg) >= MAXPGPATH) { - psql_error("The value of \"editor_lineno_arg\" is too long.\n"); - free(editor_lineno_arg); - editor_lineno_arg = NULL; - free(editorName); - editorName = NULL; - return false; + if (strlen(editor_lineno_arg) >= MAXPGPATH) { + psql_error("The value of \"editor_lineno_arg\" is too long.\n"); + free(editor_lineno_arg); + editor_lineno_arg = NULL; + free(editorName); + editorName = NULL; + return false; + } + + syssz = strlen(editorName) + strlen(editor_lineno_arg) + 10 /* for integer */ + + 1 + strlen(fname) + 10 + 1; + } else { + syssz = strlen(editorName) + strlen(fname) + 10 + 1; } /* Allocate sufficient memory for command line. */ - lineno > 0 ? (syssz = strlen(editorName) + strlen(editor_lineno_arg) + 10 /* for integer */ - + 1 + strlen(fname) + 10 + 1) : - (syssz = strlen(editorName) + strlen(fname) + 10 + 1); - sys = (char*)pg_malloc(syssz); /* @@ -1902,11 +1903,12 @@ static bool editFile(const char* fname, int lineno) check_sprintf_s(sprintf_s(sys, syssz, "exec %s '%s'", editorName, fname)); } #else - if (lineno > 0) + if (lineno > 0) { check_sprintf_s(sprintf_s( sys, syssz, SYSTEMQUOTE "\"%s\" %s%d \"%s\"" SYSTEMQUOTE, editorName, editor_lineno_arg, lineno, fname)); - else + } else { check_sprintf_s(sprintf_s(sys, syssz, SYSTEMQUOTE "\"%s\" \"%s\"" SYSTEMQUOTE, editorName, fname)); + } #endif result = system(sys); if (result == -1) {