Definition at line 24 of file dropdb.c.
28 static struct option long_options[] = {
47 char *maintenance_db = NULL;
54 bool interactive =
false;
68 while ((
c =
getopt_long(argc, argv,
"efh:ip:U:wW", long_options, &optindex)) != -1)
112 pg_log_error(
"missing required argument database name");
119 pg_log_error(
"too many command-line arguments (first is \"%s\")",
127 printf(
_(
"Database \"%s\" will be permanently removed.\n"),
dbname);
137 force ?
" WITH (FORCE)" :
"");
140 if (maintenance_db == NULL && strcmp(
dbname,
"postgres") == 0)
141 maintenance_db =
"template1";
143 cparams.
dbname = maintenance_db;
bool yesno_prompt(const char *question)
#define PG_TEXTDOMAIN(domain)
void set_pglocale_pgservice(const char *argv0, const char *app)
PGconn * connectMaintenanceDatabase(ConnParams *cparams, const char *progname, bool echo)
static void help(const char *progname)
char * PQerrorMessage(const PGconn *conn)
void PQfinish(PGconn *conn)
ExecStatusType PQresultStatus(const PGresult *res)
PGresult * PQexec(PGconn *conn, const char *query)
char * pg_strdup(const char *in)
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
#define required_argument
void pg_logging_init(const char *argv0)
#define pg_log_error(...)
#define pg_log_error_hint(...)
void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp)
PGDLLIMPORT char * optarg
const char * get_progname(const char *argv0)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
const char * fmtId(const char *rawid)
enum trivalue prompt_password
References _, appendPQExpBuffer(), conn, connectMaintenanceDatabase(), PQExpBufferData::data, dbname, _connParams::dbname, exit(), fmtId(), get_progname(), getopt_long(), handle_help_version_opts(), help(), if_exists, initPQExpBuffer(), no_argument, optarg, optind, _connParams::override_dbname, pg_log_error, pg_log_error_hint, pg_logging_init(), pg_strdup(), PG_TEXTDOMAIN, _connParams::pghost, _connParams::pgport, PGRES_COMMAND_OK, _connParams::pguser, port, PQclear(), PQerrorMessage(), PQexec(), PQfinish(), PQresultStatus(), printf, progname, _connParams::prompt_password, required_argument, set_pglocale_pgservice(), TRI_DEFAULT, TRI_NO, TRI_YES, username, and yesno_prompt().