diff options
| author | Bruce Momjian | 2000-11-13 15:18:15 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2000-11-13 15:18:15 +0000 |
| commit | 2150c2edf184f4e1a136b235e36b96c1e7fdfd60 (patch) | |
| tree | 5f043f8b1f668e74c92e9095adb62f287fe46094 /src/bin | |
| parent | 7633cada54aad935b16410c6ebc3a1ee8e606033 (diff) | |
UUNET is looking into offering PostgreSQL as a part of a managed web
hosting product, on both shared and dedicated machines. We currently
offer Oracle and MySQL, and it would be a nice middle-ground.
However, as shipped, PostgreSQL lacks the following features we need
that MySQL has:
1. The ability to listen only on a particular IP address. Each
hosting customer has their own IP address, on which all of their
servers (http, ftp, real media, etc.) run.
2. The ability to place the Unix-domain socket in a mode 700 directory.
This allows us to automatically create an empty database, with an
empty DBA password, for new or upgrading customers without having
to interactively set a DBA password and communicate it to (or from)
the customer. This in turn cuts down our install and upgrade times.
3. The ability to connect to the Unix-domain socket from within a
change-rooted environment. We run CGI programs chrooted to the
user's home directory, which is another reason why we need to be
able to specify where the Unix-domain socket is, instead of /tmp.
4. The ability to, if run as root, open a pid file in /var/run as
root, and then setuid to the desired user. (mysqld -u can almost
do this; I had to patch it, too).
The patch below fixes problem 1-3. I plan to address #4, also, but
haven't done so yet. These diffs are big enough that they should give
the PG development team something to think about in the meantime :-)
Also, I'm about to leave for 2 weeks' vacation, so I thought I'd get
out what I have, which works (for the problems it tackles), now.
With these changes, we can set up and run PostgreSQL with scripts the
same way we can with apache or proftpd or mysql.
In summary, this patch makes the following enhancements:
1. Adds an environment variable PGUNIXSOCKET, analogous to MYSQL_UNIX_PORT,
and command line options -k --unix-socket to the relevant programs.
2. Adds a -h option to postmaster to set the hostname or IP address to
listen on instead of the default INADDR_ANY.
3. Extends some library interfaces to support the above.
4. Fixes a few memory leaks in PQconnectdb().
The default behavior is unchanged from stock 7.0.2; if you don't use
any of these new features, they don't change the operation.
David J. MacKenzie
Diffstat (limited to 'src/bin')
| -rw-r--r-- | src/bin/pg_dump/pg_backup.h | 4 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 5 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.h | 1 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_backup_db.c | 12 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_dump.c | 13 | ||||
| -rw-r--r-- | src/bin/pg_dump/pg_restore.c | 9 | ||||
| -rw-r--r-- | src/bin/psql/command.c | 5 | ||||
| -rw-r--r-- | src/bin/psql/common.c | 4 | ||||
| -rw-r--r-- | src/bin/psql/help.c | 12 | ||||
| -rw-r--r-- | src/bin/psql/prompt.c | 7 | ||||
| -rw-r--r-- | src/bin/psql/startup.c | 13 | ||||
| -rw-r--r-- | src/bin/scripts/createdb | 12 | ||||
| -rw-r--r-- | src/bin/scripts/createlang.sh | 12 | ||||
| -rw-r--r-- | src/bin/scripts/createuser | 12 | ||||
| -rw-r--r-- | src/bin/scripts/dropdb | 12 | ||||
| -rw-r--r-- | src/bin/scripts/droplang | 12 | ||||
| -rw-r--r-- | src/bin/scripts/dropuser | 12 | ||||
| -rw-r--r-- | src/bin/scripts/vacuumdb | 12 |
18 files changed, 147 insertions, 22 deletions
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 8fceb26c8e2..ffe071a6655 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -99,8 +99,9 @@ typedef struct _restoreOptions { int useDB; char *dbname; - char *pgport; char *pghost; + char *pgport; + char *pgunixsocket; int ignoreVersion; int requirePassword; @@ -122,6 +123,7 @@ PGconn* ConnectDatabase(Archive *AH, const char* dbname, const char* pghost, const char* pgport, + const char* pgunixsocket, const int reqPwd, const int ignoreVersion); diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index d8a969b41e0..085a2eb3297 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -131,8 +131,9 @@ void RestoreArchive(Archive* AHX, RestoreOptions *ropt) if (AH->version < K_VERS_1_3) die_horribly(AH, "Direct database connections are not supported in pre-1.3 archives"); - ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport, - ropt->requirePassword, ropt->ignoreVersion); + ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport, + ropt->pgunixsocket, ropt->requirePassword, + ropt->ignoreVersion); /* * If no superuser was specified then see if the current user will do... diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 2c7291e6c69..a938f5e3395 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -187,6 +187,7 @@ typedef struct _archiveHandle { char *archdbname; /* DB name *read* from archive */ char *pghost; char *pgport; + char *pgunixsocket; PGconn *connection; PGconn *blobConnection; /* Connection for BLOB xref */ int txActive; /* Flag set if TX active on connection */ diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index 4b8873c3a23..082edd58241 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------- * * -*------------------------------------------------------------------------- + *------------------------------------------------------------------------- */ #include <unistd.h> /* for getopt() */ @@ -273,6 +273,7 @@ PGconn* ConnectDatabase(Archive *AHX, const char* dbname, const char* pghost, const char* pgport, + const char* pgunixsocket, const int reqPwd, const int ignoreVersion) { @@ -307,6 +308,15 @@ PGconn* ConnectDatabase(Archive *AHX, else AH->pgport = NULL; + if (pgunixsocket != NULL) + { + AH->pgport = strdup(pgunixsocket); + sprintf(tmp_string, "unixsocket=%s ", AH->pgunixsocket); + strcat(connect_string, tmp_string); + } + else + AH->pgunixsocket = NULL; + sprintf(tmp_string, "dbname=%s ", AH->dbname); strcat(connect_string, tmp_string); diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 4b765f52880..738425a3ebe 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -22,7 +22,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.177 2000/10/31 14:20:30 pjw Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.178 2000/11/13 15:18:13 momjian Exp $ * * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * @@ -200,6 +200,7 @@ help(const char *progname) " -F, --format {c|f|p} output file format (custom, files, plain text)\n" " -h, --host <hostname> server host name\n" " -i, --ignore-version proceed when database version != pg_dump version\n" + " -k, --unixsocket <path> server Unix-domain socket name\n" " -n, --no-quotes suppress most quotes around identifiers\n" " -N, --quotes enable most quotes around identifiers\n" " -o, --oids dump object ids (oids)\n" @@ -226,6 +227,7 @@ help(const char *progname) " -F {c|f|p} output file format (custom, files, plain text)\n" " -h <hostname> server host name\n" " -i proceed when database version != pg_dump version\n" + " -k <path> server Unix-domain socket name\n" " -n suppress most quotes around identifiers\n" " -N enable most quotes around identifiers\n" " -o dump object ids (oids)\n" @@ -629,6 +631,7 @@ main(int argc, char **argv) const char *dbname = NULL; const char *pghost = NULL; const char *pgport = NULL; + const char *pgunixsocket = NULL; char *tablename = NULL; bool oids = false; TableInfo *tblinfo; @@ -658,6 +661,7 @@ main(int argc, char **argv) {"attribute-inserts", no_argument, NULL, 'D'}, {"host", required_argument, NULL, 'h'}, {"ignore-version", no_argument, NULL, 'i'}, + {"unixsocket", required_argument, NULL, 'k'}, {"no-reconnect", no_argument, NULL, 'R'}, {"no-quotes", no_argument, NULL, 'n'}, {"quotes", no_argument, NULL, 'N'}, @@ -752,6 +756,10 @@ main(int argc, char **argv) ignore_version = true; break; + case 'k': /* server Unix-domain socket */ + pgunixsocket = optarg; + break; + case 'n': /* Do not force double-quotes on * identifiers */ force_quotes = false; @@ -948,7 +956,8 @@ main(int argc, char **argv) dbname = argv[optind]; /* Open the database using the Archiver, so it knows about it. Errors mean death */ - g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, use_password, ignore_version); + g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, pgunixsocket, + use_password, ignore_version); /* * Start serializable transaction to dump consistent data diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index 458482ed511..cafb7e9df60 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -101,6 +101,7 @@ struct option cmdopts[] = { { "ignore-version", 0, NULL, 'i'}, { "index", 2, NULL, 'I'}, { "list", 0, NULL, 'l'}, + { "unixsocket", 1, NULL, 'k' }, { "no-acl", 0, NULL, 'x' }, { "no-owner", 0, NULL, 'O'}, { "no-reconnect", 0, NULL, 'R' }, @@ -132,9 +133,9 @@ int main(int argc, char **argv) progname = *argv; #ifdef HAVE_GETOPT_LONG - while ((c = getopt_long(argc, argv, "acCd:f:F:h:i:lNoOp:P:rRsS:t:T:uU:vx", cmdopts, NULL)) != EOF) + while ((c = getopt_long(argc, argv, "acCd:f:F:h:i:k:lNoOp:P:rRsS:t:T:uU:vx", cmdopts, NULL)) != EOF) #else - while ((c = getopt(argc, argv, "acCd:f:F:h:i:lNoOp:P:rRsS:t:T:uU:vx")) != -1) + while ((c = getopt(argc, argv, "acCd:f:F:h:i:k:lNoOp:P:rRsS:t:T:uU:vx")) != -1) #endif { switch (c) @@ -170,6 +171,10 @@ int main(int argc, char **argv) case 'i': opts->ignoreVersion = 1; break; + case 'k': + if (strlen(optarg) != 0) + opts->pgunixsocket = strdup(optarg); + break; case 'N': opts->origOrder = 1; break; diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index d563070ae68..65c05a4ac91 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.36 2000/09/17 20:33:45 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.37 2000/11/13 15:18:14 momjian Exp $ */ #include "postgres.h" #include "command.h" @@ -1202,6 +1202,7 @@ do_connect(const char *new_dbname, const char *new_user) SetVariable(pset.vars, "USER", NULL); SetVariable(pset.vars, "HOST", NULL); SetVariable(pset.vars, "PORT", NULL); + SetVariable(pset.vars, "UNIXSOCKET", NULL); SetVariable(pset.vars, "ENCODING", NULL); /* If dbname is "" then use old name, else new one (even if NULL) */ @@ -1231,6 +1232,7 @@ do_connect(const char *new_dbname, const char *new_user) do { need_pass = false; + /* FIXME use PQconnectdb to support passing the Unix socket */ pset.db = PQsetdbLogin(PQhost(oldconn), PQport(oldconn), NULL, NULL, dbparam, userparam, pwparam); @@ -1307,6 +1309,7 @@ do_connect(const char *new_dbname, const char *new_user) SetVariable(pset.vars, "USER", PQuser(pset.db)); SetVariable(pset.vars, "HOST", PQhost(pset.db)); SetVariable(pset.vars, "PORT", PQport(pset.db)); + SetVariable(pset.vars, "UNIXSOCKET", PQunixsocket(pset.db)); SetVariable(pset.vars, "ENCODING", pg_encoding_to_char(pset.encoding)); pset.issuper = test_superuser(PQuser(pset.db)); diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index ddc2be3c4f4..da0542df593 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.23 2000/08/29 09:36:48 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/common.c,v 1.24 2000/11/13 15:18:14 momjian Exp $ */ #include "postgres.h" #include "common.h" @@ -329,6 +329,7 @@ PSQLexec(const char *query) SetVariable(pset.vars, "DBNAME", NULL); SetVariable(pset.vars, "HOST", NULL); SetVariable(pset.vars, "PORT", NULL); + SetVariable(pset.vars, "UNIXSOCKET", NULL); SetVariable(pset.vars, "USER", NULL); SetVariable(pset.vars, "ENCODING", NULL); return NULL; @@ -508,6 +509,7 @@ SendQuery(const char *query) SetVariable(pset.vars, "DBNAME", NULL); SetVariable(pset.vars, "HOST", NULL); SetVariable(pset.vars, "PORT", NULL); + SetVariable(pset.vars, "UNIXSOCKET", NULL); SetVariable(pset.vars, "USER", NULL); SetVariable(pset.vars, "ENCODING", NULL); return false; diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 3dfd7d8e8dd..b9ee9caa67a 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.32 2000/09/22 23:02:00 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/help.c,v 1.33 2000/11/13 15:18:14 momjian Exp $ */ #include "postgres.h" #include "help.h" @@ -103,6 +103,16 @@ usage(void) puts(")"); puts(" -H HTML table output mode (-P format=html)"); + + /* Display default Unix-domain socket */ + env = getenv("PGUNIXSOCKET"); + printf(" -k <path> Specify Unix domain socket name (default: "); + if (env) + fputs(env, stdout); + else + fputs("computed from the port", stdout); + puts(")"); + puts(" -l List available databases, then exit"); puts(" -n Disable readline"); puts(" -o <filename> Send query output to filename (or |pipe)"); diff --git a/src/bin/psql/prompt.c b/src/bin/psql/prompt.c index 1177c6f3f33..d29bc12ddb9 100644 --- a/src/bin/psql/prompt.c +++ b/src/bin/psql/prompt.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.13 2000/08/20 10:55:34 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.14 2000/11/13 15:18:14 momjian Exp $ */ #include "postgres.h" #include "prompt.h" @@ -190,6 +190,11 @@ get_prompt(promptStatus_t status) if (pset.db && PQport(pset.db)) strncpy(buf, PQport(pset.db), MAX_PROMPT_SIZE); break; + /* DB server Unix-domain socket */ + case '<': + if (pset.db && PQunixsocket(pset.db)) + strncpy(buf, PQunixsocket(pset.db), MAX_PROMPT_SIZE); + break; /* DB server user name */ case 'n': if (pset.db) diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index f96cc7980ba..9b0e60f0a35 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -3,7 +3,7 @@ * * Copyright 2000 by PostgreSQL Global Development Group * - * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.37 2000/09/17 20:33:45 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.38 2000/11/13 15:18:14 momjian Exp $ */ #include "postgres.h" @@ -65,6 +65,7 @@ struct adhoc_opts char *dbname; char *host; char *port; + char *unixsocket; char *username; enum _actions action; char *action_string; @@ -161,6 +162,7 @@ main(int argc, char *argv[]) do { need_pass = false; + /* FIXME use PQconnectdb to allow setting the unix socket */ pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL, options.action == ACT_LIST_DB ? "template1" : options.dbname, username, password); @@ -206,6 +208,7 @@ main(int argc, char *argv[]) SetVariable(pset.vars, "USER", PQuser(pset.db)); SetVariable(pset.vars, "HOST", PQhost(pset.db)); SetVariable(pset.vars, "PORT", PQport(pset.db)); + SetVariable(pset.vars, "UNIXSOCKET", PQunixsocket(pset.db)); SetVariable(pset.vars, "ENCODING", pg_encoding_to_char(pset.encoding)); #ifndef WIN32 @@ -320,6 +323,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) {"field-separator", required_argument, NULL, 'F'}, {"host", required_argument, NULL, 'h'}, {"html", no_argument, NULL, 'H'}, + {"unixsocket", required_argument, NULL, 'k'}, {"list", no_argument, NULL, 'l'}, {"no-readline", no_argument, NULL, 'n'}, {"output", required_argument, NULL, 'o'}, @@ -353,14 +357,14 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) memset(options, 0, sizeof *options); #ifdef HAVE_GETOPT_LONG - while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWxX?", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:lh:Hk:no:p:P:qRsStT:uU:v:VWxX?", long_options, &optindex)) != -1) #else /* not HAVE_GETOPT_LONG */ /* * Be sure to leave the '-' in here, so we can catch accidental long * options. */ - while ((c = getopt(argc, argv, "aAc:d:eEf:F:lh:Hno:p:P:qRsStT:uU:v:VWxX?-")) != -1) + while ((c = getopt(argc, argv, "aAc:d:eEf:F:lh:Hk:no:p:P:qRsStT:uU:v:VWxX?-")) != -1) #endif /* not HAVE_GETOPT_LONG */ { switch (c) @@ -406,6 +410,9 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) case 'l': options->action = ACT_LIST_DB; break; + case 'k': + options->unixsocket = optarg; + break; case 'n': options->no_readline = true; break; diff --git a/src/bin/scripts/createdb b/src/bin/scripts/createdb index 3601811b249..213913ba890 100644 --- a/src/bin/scripts/createdb +++ b/src/bin/scripts/createdb @@ -11,7 +11,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.9 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createdb,v 1.10 2000/11/13 15:18:14 momjian Exp $ # #------------------------------------------------------------------------- @@ -50,6 +50,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; --username|-U) PSQLOPT="$PSQLOPT -U $2" shift;; @@ -114,6 +123,7 @@ if [ "$usage" ]; then echo " -E, --encoding=ENCODING Multibyte encoding for the database" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as" echo " -W, --password Prompt for password" echo " -e, --echo Show the query being sent to the backend" diff --git a/src/bin/scripts/createlang.sh b/src/bin/scripts/createlang.sh index 4275dc6e93f..c22dcba652f 100644 --- a/src/bin/scripts/createlang.sh +++ b/src/bin/scripts/createlang.sh @@ -8,7 +8,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.17 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createlang.sh,v 1.18 2000/11/13 15:18:14 momjian Exp $ # #------------------------------------------------------------------------- @@ -65,6 +65,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; --username|-U) PSQLOPT="$PSQLOPT -U $2" shift;; @@ -126,6 +135,7 @@ if [ "$usage" ]; then echo "Options:" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as" echo " -W, --password Prompt for password" echo " -d, --dbname=DBNAME Database to install language in" diff --git a/src/bin/scripts/createuser b/src/bin/scripts/createuser index 62c674d99e6..198e4b81cfa 100644 --- a/src/bin/scripts/createuser +++ b/src/bin/scripts/createuser @@ -8,7 +8,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.12 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/createuser,v 1.13 2000/11/13 15:18:14 momjian Exp $ # # Note - this should NOT be setuid. # @@ -63,6 +63,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; # Note: These two specify the user to connect as (like in psql), # not the user you're creating. --username|-U) @@ -135,6 +144,7 @@ if [ "$usage" ]; then echo " -P, --pwprompt Assign a password to new user" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as (not the one to create)" echo " -W, --password Prompt for password to connect" echo " -e, --echo Show the query being sent to the backend" diff --git a/src/bin/scripts/dropdb b/src/bin/scripts/dropdb index 1bb6f10f253..586b62ac7f7 100644 --- a/src/bin/scripts/dropdb +++ b/src/bin/scripts/dropdb @@ -10,7 +10,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.7 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropdb,v 1.8 2000/11/13 15:18:14 momjian Exp $ # #------------------------------------------------------------------------- @@ -59,6 +59,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; --username|-U) PSQLOPT="$PSQLOPT -U $2" shift;; @@ -103,6 +112,7 @@ if [ "$usage" ]; then echo "Options:" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as" echo " -W, --password Prompt for password" echo " -i, --interactive Prompt before deleting anything" diff --git a/src/bin/scripts/droplang b/src/bin/scripts/droplang index 3205ad35772..46856e4241d 100644 --- a/src/bin/scripts/droplang +++ b/src/bin/scripts/droplang @@ -8,7 +8,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.8 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/droplang,v 1.9 2000/11/13 15:18:14 momjian Exp $ # #------------------------------------------------------------------------- @@ -65,6 +65,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; --username|-U) PSQLOPT="$PSQLOPT -U $2" shift;; @@ -113,6 +122,7 @@ if [ "$usage" ]; then echo "Options:" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as" echo " -W, --password Prompt for password" echo " -d, --dbname=DBNAME Database to remove language from" diff --git a/src/bin/scripts/dropuser b/src/bin/scripts/dropuser index 81a00f9c1c8..4aa858124b2 100644 --- a/src/bin/scripts/dropuser +++ b/src/bin/scripts/dropuser @@ -8,7 +8,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.7 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/dropuser,v 1.8 2000/11/13 15:18:14 momjian Exp $ # # Note - this should NOT be setuid. # @@ -59,6 +59,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; # Note: These two specify the user to connect as (like in psql), # not the user you're dropping. --username|-U) @@ -105,6 +114,7 @@ if [ "$usage" ]; then echo "Options:" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as (not the one to drop)" echo " -W, --password Prompt for password to connect" echo " -i, --interactive Prompt before deleting anything" diff --git a/src/bin/scripts/vacuumdb b/src/bin/scripts/vacuumdb index af038add8a7..fb1db8bfe67 100644 --- a/src/bin/scripts/vacuumdb +++ b/src/bin/scripts/vacuumdb @@ -11,7 +11,7 @@ # # # IDENTIFICATION -# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.10 2000/11/11 22:59:48 petere Exp $ +# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.11 2000/11/13 15:18:14 momjian Exp $ # #------------------------------------------------------------------------- @@ -52,6 +52,15 @@ do --port=*) PSQLOPT="$PSQLOPT -p "`echo $1 | sed 's/^--port=//'` ;; + --unixsocket|-k) + PSQLOPT="$PSQLOPT -k $2" + shift;; + -k*) + PSQLOPT="$PSQLOPT $1" + ;; + --unixsocket=*) + PSQLOPT="$PSQLOPT -k "`echo $1 | sed 's/^--unixsocket=//'` + ;; --username|-U) PSQLOPT="$PSQLOPT -U $2" shift;; @@ -121,6 +130,7 @@ if [ "$usage" ]; then echo "Options:" echo " -h, --host=HOSTNAME Database server host" echo " -p, --port=PORT Database server port" + echo " -k, --unixsocket=PATH Database server Unix-domain socket name" echo " -U, --username=USERNAME Username to connect as" echo " -W, --password Prompt for password" echo " -d, --dbname=DBNAME Database to vacuum" |
