mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Accept SET SESSION AUTHORIZATION DEFAULT and RESET SESSION AUTHORIZATION
to reset session userid to the originally-authenticated name. Also, relax SET SESSION AUTHORIZATION to allow specifying one's own username even if one is not superuser, so as to avoid unnecessary error messages when loading a pg_dump file that uses this command. Per discussion from several months ago.
This commit is contained in:
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.65 2002/04/22 15:13:53 thomas Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/commands/variable.c,v 1.66 2002/05/06 19:47:30 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -815,6 +815,15 @@ reset_server_encoding(void)
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
show_session_authorization(void)
|
||||
{
|
||||
elog(INFO, "Current session authorization is '%s'",
|
||||
GetUserName(GetSessionUserId()));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* SetPGVariable()
|
||||
* Dispatcher for handling SET commands.
|
||||
@ -902,6 +911,8 @@ GetPGVariable(const char *name)
|
||||
show_server_encoding();
|
||||
else if (strcasecmp(name, "seed") == 0)
|
||||
show_random_seed();
|
||||
else if (strcasecmp(name, "session_authorization") == 0)
|
||||
show_session_authorization();
|
||||
else if (strcasecmp(name, "all") == 0)
|
||||
{
|
||||
ShowAllGUCConfig();
|
||||
@ -935,6 +946,8 @@ ResetPGVariable(const char *name)
|
||||
reset_server_encoding();
|
||||
else if (strcasecmp(name, "seed") == 0)
|
||||
reset_random_seed();
|
||||
else if (strcasecmp(name, "session_authorization") == 0)
|
||||
SetSessionAuthorization(NULL);
|
||||
else if (strcasecmp(name, "all") == 0)
|
||||
{
|
||||
reset_random_seed();
|
||||
@ -942,6 +955,7 @@ ResetPGVariable(const char *name)
|
||||
reset_client_encoding();
|
||||
reset_datestyle();
|
||||
reset_timezone();
|
||||
/* should we reset session authorization here? */
|
||||
|
||||
ResetAllOptions(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user