28main(
int argc,
char *argv[])
102 while ((
c =
getopt_long(argc, argv,
"a:c:dDeEg:h:iIlLm:p:PrRsSU:v:wW",
208 pg_log_error(
"too many command-line arguments (first is \"%s\")",
311 pg_fatal(
"password encryption failed: %s",
338 if (replication ==
TRI_NO)
357 for (cell = roles.
head; cell; cell = cell->
next)
371 for (cell = members.
head; cell; cell = cell->
next)
385 for (cell =
admins.head; cell; cell = cell->
next)
420 printf(
_(
" -a, --with-admin=ROLE ROLE will be a member of new role with admin\n"
422 printf(
_(
" -c, --connection-limit=N connection limit for role (default: no limit)\n"));
423 printf(
_(
" -d, --createdb role can create new databases\n"));
424 printf(
_(
" -D, --no-createdb role cannot create databases (default)\n"));
425 printf(
_(
" -e, --echo show the commands being sent to the server\n"));
426 printf(
_(
" -g, --member-of=ROLE new role will be a member of ROLE\n"));
427 printf(
_(
" --role=ROLE (same as --member-of, deprecated)\n"));
428 printf(
_(
" -i, --inherit role inherits privileges of roles it is a\n"
429 " member of (default)\n"));
430 printf(
_(
" -I, --no-inherit role does not inherit privileges\n"));
431 printf(
_(
" -l, --login role can login (default)\n"));
432 printf(
_(
" -L, --no-login role cannot login\n"));
433 printf(
_(
" -m, --with-member=ROLE ROLE will be a member of new role\n"));
434 printf(
_(
" -P, --pwprompt assign a password to new role\n"));
435 printf(
_(
" -r, --createrole role can create new roles\n"));
436 printf(
_(
" -R, --no-createrole role cannot create roles (default)\n"));
437 printf(
_(
" -s, --superuser role will be superuser\n"));
438 printf(
_(
" -S, --no-superuser role will not be superuser (default)\n"));
439 printf(
_(
" -v, --valid-until=TIMESTAMP\n"
440 " password expiration date and time for role\n"));
441 printf(
_(
" -V, --version output version information, then exit\n"));
442 printf(
_(
" --interactive prompt for missing role name and attributes rather\n"
443 " than using defaults\n"));
444 printf(
_(
" --bypassrls role can bypass row-level security (RLS) policy\n"));
445 printf(
_(
" --no-bypassrls role cannot bypass row-level security (RLS) policy\n"
447 printf(
_(
" --replication role can initiate replication\n"));
448 printf(
_(
" --no-replication role cannot initiate replication (default)\n"));
449 printf(
_(
" -?, --help show this help, then exit\n"));
450 printf(
_(
"\nConnection options:\n"));
451 printf(
_(
" -h, --host=HOSTNAME database server host or socket directory\n"));
452 printf(
_(
" -p, --port=PORT database server port\n"));
453 printf(
_(
" -U, --username=USERNAME user name to connect as (not the one to create)\n"));
454 printf(
_(
" -w, --no-password never prompt for password\n"));
455 printf(
_(
" -W, --password force password prompt\n"));
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)
#define fprintf(file, fmt, msg)
Oid createdb(ParseState *pstate, const CreatedbStmt *stmt)
char * PQencryptPasswordConn(PGconn *conn, const char *passwd, const char *user, const char *algorithm)
int PQclientEncoding(const PGconn *conn)
void PQfinish(PGconn *conn)
char * PQerrorMessage(const PGconn *conn)
void PQfreemem(void *ptr)
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(...)
bool option_parse_int(const char *optarg, const char *optname, int min_range, int max_range, int *result)
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 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 simple_string_list_append(SimpleStringList *list, const char *val)
char * simple_prompt(const char *prompt, bool echo)
const char * fmtId(const char *rawid)
void setFmtEncoding(int encoding)
void appendStringLiteralConn(PQExpBuffer buf, const char *str, PGconn *conn)
char val[FLEXIBLE_ARRAY_MEMBER]
struct SimpleStringListCell * next
SimpleStringListCell * head
enum trivalue prompt_password
const char * get_user_name_or_exit(const char *progname)