diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/pg_dump/pg_backup.h | 3 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.c | 90 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_backup_archiver.h | 4 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_backup_db.c | 41 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_dump.c | 44 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_dump.h | 4 | ||||
-rw-r--r-- | src/bin/pg_dump/pg_restore.c | 106 |
7 files changed, 214 insertions, 78 deletions
diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 7e555957eb0..282738d882d 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.13 2001/06/27 21:21:37 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup.h,v 1.14 2001/08/22 20:23:23 petere Exp $ * * Modifications - 28-Jun-2000 - pjw@rhyme.com.au * @@ -85,6 +85,7 @@ typedef struct _restoreOptions * original object owner */ int noReconnect; /* Don't reconnect to database under any * cirsumstances */ + int use_setsessauth; /* use SET SESSSION AUTHORIZATION instead of \connect */ char *superuser; /* Username to use as superuser */ int dataOnly; int dropSchema; diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 982cabbcf2c..4ada30994f2 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.31 2001/08/19 22:17:03 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.32 2001/08/22 20:23:23 petere Exp $ * * Modifications - 28-Jun-2000 - pjw@rhyme.com.au * @@ -78,7 +78,7 @@ static ArchiveHandle *_allocAH(const char *FileSpec, const ArchiveFormat fmt, static int _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isData); static void _reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te); -static void _reconnectAsUser(ArchiveHandle *AH, const char *dbname, char *user); +static void _reconnectAsUser(ArchiveHandle *AH, const char *dbname, const char *user); static int _tocEntryRequired(TocEntry *te, RestoreOptions *ropt); static void _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt); @@ -251,7 +251,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) /* We want the schema */ ahlog(AH, 1, "dropping %s %s\n", te->desc, te->name); /* Reconnect if necessary */ - _reconnectAsOwner(AH, "-", te); + _reconnectAsOwner(AH, NULL, te); /* Drop it */ ahprintf(AH, "%s", te->dropStmt); } @@ -283,7 +283,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) if ((reqs & 1) != 0) /* We want the schema */ { /* Reconnect if necessary */ - _reconnectAsOwner(AH, "-", te); + _reconnectAsOwner(AH, NULL, te); ahlog(AH, 1, "creating %s %s\n", te->desc, te->name); _printTocEntry(AH, te, ropt, false); @@ -345,7 +345,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) * Reconnect if necessary (_disableTriggers may have * reconnected) */ - _reconnectAsOwner(AH, "-", te); + _reconnectAsOwner(AH, NULL, te); ahlog(AH, 1, "restoring data for table %s\n", te->name); @@ -448,6 +448,10 @@ NewRestoreOptions(void) return opts; } +/* + * Returns true if we're restoring directly to the database (and + * aren't just making a psql script that can do the restoration). + */ static int _restoringToDB(ArchiveHandle *AH) { @@ -486,7 +490,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop */ if (ropt->noOwner) oldUser = strdup(ConnectedUser(AH)); - _reconnectAsUser(AH, "-", ropt->superuser); + _reconnectAsUser(AH, NULL, ropt->superuser); } } @@ -514,7 +518,7 @@ _disableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *rop */ if (ropt->noOwner && oldUser) { - _reconnectAsUser(AH, "-", oldUser); + _reconnectAsUser(AH, NULL, oldUser); free(oldUser); } } @@ -546,7 +550,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt if (ropt->noOwner) oldUser = strdup(ConnectedUser(AH)); - _reconnectAsUser(AH, "-", ropt->superuser); + _reconnectAsUser(AH, NULL, ropt->superuser); } } @@ -577,7 +581,7 @@ _enableTriggersIfNecessary(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt */ if (ropt->noOwner && oldUser) { - _reconnectAsUser(AH, "-", oldUser); + _reconnectAsUser(AH, NULL, oldUser); free(oldUser); } } @@ -1895,26 +1899,71 @@ _tocEntryRequired(TocEntry *te, RestoreOptions *ropt) return res; } + +/* + * Issue the commands to connect to the database as the specified user + * to the specified database. The database name may be NULL, then the + * current database is kept. If reconnects were disallowed by the + * user, this won't do anything. + * + * If we're currently restoring right into a database, this will + * actuall establish a connection. Otherwise it puts a \connect into + * the script output. + */ static void -_reconnectAsUser(ArchiveHandle *AH, const char *dbname, char *user) +_reconnectAsUser(ArchiveHandle *AH, const char *dbname, const char *user) { - if (AH->ropt && AH->ropt->noReconnect) - return; + if (!user || strlen(user) == 0 + || (strcmp(AH->currUser, user) == 0 && !dbname)) + return; /* no need to do anything */ - if (user && strlen(user) != 0 - && ((strcmp(AH->currUser, user) != 0) || (strcmp(dbname, "-") != 0))) + /* Use SET SESSION AUTHORIZATION if allowed and no database change needed */ + if (!dbname && AH->ropt->use_setsessauth) { if (RestoringToDB(AH)) - ReconnectDatabase(AH, dbname, user); - else - ahprintf(AH, "\\connect %s %s\n", dbname, user); - if (AH->currUser) - free(AH->currUser); + { + PQExpBuffer qry = createPQExpBuffer(); + PGresult *res; + + appendPQExpBuffer(qry, "SET SESSION AUTHORIZATION '%s';", user); + res = PQexec(AH->connection, qry->data); + + if (!res || PQresultStatus(res) != PGRES_COMMAND_OK) + die_horribly(AH, modulename, "could not set session user to %s: %s", + user, PQerrorMessage(AH->connection)); - AH->currUser = strdup(user); + PQclear(res); + destroyPQExpBuffer(qry); + } + else + ahprintf(AH, "SET SESSION AUTHORIZATION '%s';\n\n", user); } + /* When -R was given, don't do anything. */ + else if (AH->ropt && AH->ropt->noReconnect) + return; + + else if (RestoringToDB(AH)) + ReconnectToServer(AH, dbname, user); + else + /* FIXME: does not handle mixed case user names */ + ahprintf(AH, "\\connect %s %s\n\n", + dbname ? dbname : "-", + user ? user : "-"); + + /* NOTE: currUser keeps track of what the imaginary session user + in our script is */ + if (AH->currUser) + free(AH->currUser); + + AH->currUser = strdup(user); } + +/* + * Issues the commands to connect to the database (or the current one, + * if NULL) as the owner of the the given TOC entry object. If + * changes in ownership are not allowed, this doesn't do anything. + */ static void _reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te) { @@ -1924,6 +1973,7 @@ _reconnectAsOwner(ArchiveHandle *AH, const char *dbname, TocEntry *te) _reconnectAsUser(AH, dbname, te->owner); } + static int _printTocEntry(ArchiveHandle *AH, TocEntry *te, RestoreOptions *ropt, bool isData) { diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 16a1c06dfe6..fee94d83b0f 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.36 2001/07/03 20:21:48 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.37 2001/08/22 20:23:23 petere Exp $ * * Modifications - 28-Jun-2000 - pjw@rhyme.com.au * - Initial version. @@ -310,7 +310,7 @@ extern int isValidTarHeader(char *header); extern OutputContext SetOutput(ArchiveHandle *AH, char *filename, int compression); extern void ResetOutput(ArchiveHandle *AH, OutputContext savedContext); extern int RestoringToDB(ArchiveHandle *AH); -extern int ReconnectDatabase(ArchiveHandle *AH, const char *dbname, char *newUser); +extern int ReconnectToServer(ArchiveHandle *AH, const char *dbname, const char *newUser); extern int UserIsSuperuser(ArchiveHandle *AH, char *user); extern char *ConnectedUser(ArchiveHandle *AH); extern int ConnectedUserIsSuperuser(ArchiveHandle *AH); diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index f08a0d3085f..3bc49e44358 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -5,7 +5,7 @@ * Implements the basic DB functions used by the archiver. * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.23 2001/08/12 19:02:39 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.24 2001/08/22 20:23:23 petere Exp $ * * NOTES * @@ -40,7 +40,7 @@ static const char *modulename = gettext_noop("archiver (db)"); static void _check_database_version(ArchiveHandle *AH, bool ignoreVersion); -static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, char *newUser); +static PGconn *_connectDB(ArchiveHandle *AH, const char *newdbname, const char *newUser); static int _executeSqlCommand(ArchiveHandle *AH, PGconn *conn, PQExpBuffer qry, char *desc); static void notice_processor(void *arg, const char *message); @@ -226,29 +226,44 @@ ConnectedUser(ArchiveHandle *AH) } /* - * Reconnect the DB associated with the archive handle + * Reconnect to the server. If dbname is not NULL, use that database, + * else the one associated with the archive handle. If username is + * not NULL, use that user name, else the one from the handle. If + * both the database and the user and match the existing connection + * already, nothing will be done. + * + * Returns 1 in any case. */ int -ReconnectDatabase(ArchiveHandle *AH, const char *newdbname, char *newUser) +ReconnectToServer(ArchiveHandle *AH, const char *dbname, const char *username) { PGconn *newConn; - char *dbname; + const char *newdbname; + const char *newusername; + + if (!dbname) + newdbname = PQdb(AH->connection); + else + newdbname = dbname; - if (!newdbname || (strcmp(newdbname, "-") == 0)) - dbname = PQdb(AH->connection); + if (!username) + newusername = PQuser(AH->connection); else - dbname = (char *) newdbname; + newusername = username; /* Let's see if the request is already satisfied */ - if (strcmp(PQuser(AH->connection), newUser) == 0 && strcmp(newdbname, PQdb(AH->connection)) == 0) + if (strcmp(newusername, PQuser(AH->connection)) == 0 + && strcmp(newdbname, PQdb(AH->connection)) == 0) return 1; - newConn = _connectDB(AH, dbname, newUser); + newConn = _connectDB(AH, newdbname, newusername); PQfinish(AH->connection); AH->connection = newConn; + free(AH->username); - AH->username = strdup(newUser); + AH->username = strdup(newusername); + /* XXX Why don't we update AH->dbname? */ return 1; } @@ -257,7 +272,7 @@ ReconnectDatabase(ArchiveHandle *AH, const char *newdbname, char *newUser) * Connect to the db again. */ static PGconn * -_connectDB(ArchiveHandle *AH, const char *reqdb, char *requser) +_connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser) { int need_pass; PGconn *newConn; @@ -267,7 +282,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, char *requser) char *newdb; char *newuser; - if (!reqdb || (strcmp(reqdb, "-") == 0)) + if (!reqdb) newdb = PQdb(AH->connection); else newdb = (char *) reqdb; diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 56067a34ee5..f81439e2036 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.223 2001/08/19 22:17:03 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.224 2001/08/22 20:23:23 petere Exp $ * *------------------------------------------------------------------------- */ @@ -167,6 +167,9 @@ help(const char *progname) " -v, --verbose verbose mode\n" " -W, --password force password prompt (should happen automatically)\n" " -x, --no-privileges do not dump privileges (grant/revoke)\n" + " -X use-set-session-authorization, --use-set-session-authorization\n" + " output SET SESSION AUTHORIZATION commands rather\n" + " than \\connect commands\n" " -Z, --compress {0-9} compression level for compressed formats\n" )); #else @@ -198,6 +201,9 @@ help(const char *progname) " -v verbose mode\n" " -W force password prompt (should happen automatically)\n" " -x do not dump privileges (grant/revoke)\n" + " -X use-set-session-authorization\n" + " output SET SESSION AUTHORIZATION commands rather\n" + " than \\connect commands\n" " -Z {0-9} compression level for compressed formats\n" )); #endif @@ -628,6 +634,7 @@ main(int argc, char **argv) int outputBlobs = 0; int outputNoOwner = 0; int outputNoReconnect = 0; + static int use_setsessauth = 0; char *outputSuperuser = NULL; RestoreOptions *ropt; @@ -661,7 +668,11 @@ main(int argc, char **argv) {"no-acl", no_argument, NULL, 'x'}, {"compress", required_argument, NULL, 'Z'}, {"help", no_argument, NULL, '?'}, - {"version", no_argument, NULL, 'V'} + {"version", no_argument, NULL, 'V'}, + + /* the following options don't have an equivalent short option + letter, but are available as '-X long-name' */ + {"use-set-session-authorization", no_argument, &use_setsessauth, 1} }; int optindex; @@ -709,9 +720,9 @@ main(int argc, char **argv) } #ifdef HAVE_GETOPT_LONG - while ((c = getopt_long(argc, argv, "abcCdDf:F:h:inNoOp:RsS:t:uU:vWxzZ:V?", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "abcCdDf:F:h:inNoOp:RsS:t:uU:vWxX:zZ:V?", long_options, &optindex)) != -1) #else - while ((c = getopt(argc, argv, "abcCdDf:F:h:inNoOp:RsS:t:uU:vWxzZ:V?-")) != -1) + while ((c = getopt(argc, argv, "abcCdDf:F:h:inNoOp:RsS:t:uU:vWxX:zZ:V?-")) != -1) #endif { @@ -851,6 +862,26 @@ main(int argc, char **argv) aclsSkip = true; break; + /* + * Option letters were getting scarce, so I invented + * this new scheme: '-X feature' turns on some + * feature. Compare to the -f option in GCC. You + * should also add an equivalent GNU-style option + * --feature. Features that require arguments should + * use '-X feature=foo'. + */ + case 'X': + if (strcmp(optarg, "use-set-session-authorization")==0) + use_setsessauth = 1; + else + { + fprintf(stderr, + gettext("%s: invalid -X option -- %s\n"), + progname, optarg); + fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); + exit(1); + } + break; case 'Z': /* Compression Level */ compressLevel = atoi(optarg); break; @@ -863,6 +894,10 @@ main(int argc, char **argv) progname); exit(1); break; +#else + /* This covers the long options equivalent to -X xxx. */ + case 0: + break; #endif default: fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); @@ -1040,6 +1075,7 @@ main(int argc, char **argv) ropt->create = outputCreate; ropt->noOwner = outputNoOwner; ropt->noReconnect = outputNoReconnect; + ropt->use_setsessauth = use_setsessauth; if (outputSuperuser) ropt->superuser = outputSuperuser; diff --git a/src/bin/pg_dump/pg_dump.h b/src/bin/pg_dump/pg_dump.h index 4580f268b02..aff3bc7ea00 100644 --- a/src/bin/pg_dump/pg_dump.h +++ b/src/bin/pg_dump/pg_dump.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: pg_dump.h,v 1.69 2001/08/10 18:57:38 tgl Exp $ + * $Id: pg_dump.h,v 1.70 2001/08/22 20:23:23 petere Exp $ * * Modifications - 6/12/96 - dave@bensoft.com - version 1.13.dhb.2 * @@ -193,7 +193,7 @@ typedef struct _oprInfo } OprInfo; /* global decls */ -extern bool g_force_quotes; /* double-quotes for identifiers flag */ +extern bool force_quotes; /* double-quotes for identifiers flag */ extern bool g_verbose; /* verbose flag */ extern Oid g_last_builtin_oid; /* value of the last builtin oid */ extern Archive *g_fout; /* the script file */ diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index 3ba07e848b2..0bff04903cb 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -34,7 +34,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.24 2001/08/19 22:17:03 petere Exp $ + * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_restore.c,v 1.25 2001/08/22 20:23:24 petere Exp $ * * Modifications - 28-Jun-2000 - pjw@rhyme.com.au * @@ -81,39 +81,6 @@ static char *_cleanupName(char *name); typedef struct option optType; -#ifdef HAVE_GETOPT_LONG -struct option cmdopts[] = { - {"clean", 0, NULL, 'c'}, - {"create", 0, NULL, 'C'}, - {"data-only", 0, NULL, 'a'}, - {"dbname", 1, NULL, 'd'}, - {"file", 1, NULL, 'f'}, - {"format", 1, NULL, 'F'}, - {"function", 1, NULL, 'P'}, - {"host", 1, NULL, 'h'}, - {"ignore-version", 0, NULL, 'i'}, - {"index", 1, NULL, 'I'}, - {"list", 0, NULL, 'l'}, - {"no-privileges", 0, NULL, 'x'}, - {"no-acl", 0, NULL, 'x'}, - {"no-owner", 0, NULL, 'O'}, - {"no-reconnect", 0, NULL, 'R'}, - {"port", 1, NULL, 'p'}, - {"oid-order", 0, NULL, 'o'}, - {"orig-order", 0, NULL, 'N'}, - {"password", 0, NULL, 'W'}, - {"rearrange", 0, NULL, 'r'}, - {"schema-only", 0, NULL, 's'}, - {"superuser", 1, NULL, 'S'}, - {"table", 1, NULL, 't'}, - {"trigger", 1, NULL, 'T'}, - {"use-list", 1, NULL, 'L'}, - {"username", 1, NULL, 'U'}, - {"verbose", 0, NULL, 'v'}, - {NULL, 0, NULL, 0} -}; - -#endif int main(int argc, char **argv) @@ -124,6 +91,45 @@ main(int argc, char **argv) char *fileSpec = NULL; extern int optind; extern char *optarg; + static int use_setsessauth = 0; + +#ifdef HAVE_GETOPT_LONG + struct option cmdopts[] = { + {"clean", 0, NULL, 'c'}, + {"create", 0, NULL, 'C'}, + {"data-only", 0, NULL, 'a'}, + {"dbname", 1, NULL, 'd'}, + {"file", 1, NULL, 'f'}, + {"format", 1, NULL, 'F'}, + {"function", 1, NULL, 'P'}, + {"host", 1, NULL, 'h'}, + {"ignore-version", 0, NULL, 'i'}, + {"index", 1, NULL, 'I'}, + {"list", 0, NULL, 'l'}, + {"no-privileges", 0, NULL, 'x'}, + {"no-acl", 0, NULL, 'x'}, + {"no-owner", 0, NULL, 'O'}, + {"no-reconnect", 0, NULL, 'R'}, + {"port", 1, NULL, 'p'}, + {"oid-order", 0, NULL, 'o'}, + {"orig-order", 0, NULL, 'N'}, + {"password", 0, NULL, 'W'}, + {"rearrange", 0, NULL, 'r'}, + {"schema-only", 0, NULL, 's'}, + {"superuser", 1, NULL, 'S'}, + {"table", 1, NULL, 't'}, + {"trigger", 1, NULL, 'T'}, + {"use-list", 1, NULL, 'L'}, + {"username", 1, NULL, 'U'}, + {"verbose", 0, NULL, 'v'}, + + /* the following options don't have an equivalent short option + letter, but are available as '-X long-name' */ + {"use-set-session-authorization", no_argument, &use_setsessauth, 1}, + {NULL, 0, NULL, 0} + }; +#endif /* HAVE_GETOPT_LONG */ + #ifdef ENABLE_NLS setlocale(LC_ALL, ""); @@ -153,9 +159,9 @@ main(int argc, char **argv) } #ifdef HAVE_GETOPT_LONG - while ((c = getopt_long(argc, argv, "acCd:f:F:h:i:lL:NoOp:P:rRsS:t:T:uU:vWx", cmdopts, NULL)) != EOF) + while ((c = getopt_long(argc, argv, "acCd:f:F:h:i:lL:NoOp:P:rRsS:t:T:uU:vWxX:", cmdopts, NULL)) != EOF) #else - while ((c = getopt(argc, argv, "acCd:f:F:h:i:lL:NoOp:P:rRsS:t:T:uU:vWx")) != -1) + while ((c = getopt(argc, argv, "acCd:f:F:h:i:lL:NoOp:P:rRsS:t:T:uU:vWxX:")) != -1) #endif { switch (c) @@ -267,6 +273,26 @@ main(int argc, char **argv) case 'x': /* skip ACL dump */ opts->aclsSkip = 1; break; + + case 'X': + if (strcmp(optarg, "use-set-session-authorization")==0) + use_setsessauth = 1; + else + { + fprintf(stderr, + gettext("%s: invalid -X option -- %s\n"), + progname, optarg); + fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); + exit(1); + } + break; + +#ifdef HAVE_GETOPT_LONG + /* This covers the long options equivalent to -X xxx. */ + case 0: + break; +#endif + default: fprintf(stderr, gettext("Try '%s --help' for more information.\n"), progname); exit(1); @@ -278,6 +304,8 @@ main(int argc, char **argv) else fileSpec = NULL; + opts->use_setsessauth = use_setsessauth; + if (opts->formatName) { @@ -381,6 +409,9 @@ usage(const char *progname) " -v, --verbose verbose mode\n" " -W, --password force password prompt (should happen automatically)\n" " -x, --no-privileges skip restoration of access privileges (grant/revoke)\n" + " -X use-set-session-authorization, --use-set-session-authorization\n" + " use SET SESSION AUTHORIZATION commands instead\n" + " of reconnecting, if possible\n" )); #else /* not HAVE_GETOPT_LONG */ @@ -414,6 +445,9 @@ usage(const char *progname) " -v verbose mode\n" " -W force password prompt (should happen automatically)\n" " -x skip restoration of access privileges (grant/revoke)\n" + " -X use-set-session-authorization\n" + " use SET SESSION AUTHORIZATION commands instead\n" + " of reconnecting, if possible\n" )); #endif puts(gettext("If no input file name is supplied, then standard input is used.\n")); |