Definition at line 24 of file createdb.c.
26 static struct option long_options[] = {
54 const char *maintenance_db = NULL;
64 char *
template = NULL;
66 char *strategy = NULL;
71 char *builtin_locale = NULL;
72 char *icu_locale = NULL;
86 while ((
c =
getopt_long(argc, argv,
"D:eE:h:l:O:p:S:T:U:wW", long_options, &optindex)) != -1)
166 pg_log_error(
"too many command-line arguments (first is \"%s\")",
180 if (getenv(
"PGDATABASE"))
181 dbname = getenv(
"PGDATABASE");
182 else if (getenv(
"PGUSER"))
183 dbname = getenv(
"PGUSER");
189 if (maintenance_db == NULL && strcmp(
dbname,
"postgres") == 0)
190 maintenance_db =
"template1";
192 cparams.
dbname = maintenance_db;
279 pg_log_error(
"comment creation failed (database was created): %s",
#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
static char locale_provider
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
#define pg_char_to_encoding
const char * get_progname(const char *argv0)
void printfPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void initPQExpBuffer(PQExpBuffer str)
void appendPQExpBuffer(PQExpBuffer str, const char *fmt,...)
void appendPQExpBufferChar(PQExpBuffer str, char ch)
void appendPQExpBufferStr(PQExpBuffer str, const char *data)
void appendStringLiteralConn(PQExpBuffer buf, const char *str, PGconn *conn)
const char * fmtId(const char *rawid)
enum trivalue prompt_password
const char * get_user_name_or_exit(const char *progname)
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), appendStringLiteralConn(), comment, conn, connectMaintenanceDatabase(), PQExpBufferData::data, dbname, _connParams::dbname, encoding, exit(), fmtId(), get_progname(), get_user_name_or_exit(), getopt_long(), handle_help_version_opts(), help(), icu_rules, initPQExpBuffer(), lc_collate, lc_ctype, locale, locale_provider, no_argument, optarg, optind, _connParams::override_dbname, pg_char_to_encoding, pg_fatal, 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, printfPQExpBuffer(), progname, _connParams::prompt_password, required_argument, set_pglocale_pgservice(), tablespace, TRI_DEFAULT, TRI_NO, TRI_YES, and username.