diff -rpcd a/src/backend/main/main.c b/src/backend/main/main.c *** a/src/backend/main/main.c 2013-12-02 09:17:05.000000000 +0900 --- b/src/backend/main/main.c 2013-12-05 16:24:51.000000000 +0900 *************** static char *get_current_username(const *** 58,63 **** --- 58,68 ---- int main(int argc, char *argv[]) { + #ifdef WIN32 + int i; + bool check_if_admin = true; + #endif + progname = get_progname(argv[0]); /* *************** main(int argc, char *argv[]) *** 159,168 **** } } /* * Make sure we are not running as root. */ ! check_root(progname); /* * Dispatch to one of various subprograms depending on first argument. --- 164,191 ---- } } + #ifdef WIN32 + + /* + * Allow execution of PostgreSQL by a user with administrative permissions + * when -C, --describe-config, or --single is specified. The reasons are: + * 1)With these switches, there is no fear of process hijack. 2)The DBA + * wants to use them. 3)pg_ctl runs "postgres -C". + */ + for (i = 1; i < argc; i++) + if (strncmp(argv[i], "-C", 2) == 0 || + strcmp(argv[i], "--describe-config") == 0 || + strcmp(argv[i], "--single") == 0) + check_if_admin = false; + #endif + /* * Make sure we are not running as root. */ ! #ifdef WIN32 ! if (check_if_admin) ! #endif ! check_root(progname); /* * Dispatch to one of various subprograms depending on first argument.