set_session_authorization.7

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 81 行

7
81
字号
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "SET SESSION AUTHORIZATION" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMESET SESSION AUTHORIZATION \- set the session user identifier and the current user identifier of the current session.SH SYNOPSIS.sp.nfSET [ SESSION | LOCAL ] SESSION AUTHORIZATION \fIusername\fRSET [ SESSION | LOCAL ] SESSION AUTHORIZATION DEFAULTRESET SESSION AUTHORIZATION.sp.fi.SH "DESCRIPTION".PPThis command sets the session user identifier and the current useridentifier of the current SQL session to be \fIusername\fR. The user name may bewritten as either an identifier or a string literal. Using thiscommand, it is possible, for example, to temporarily become anunprivileged user and later switch back to being a superuser..PPThe session user identifier is initially set to be the (possiblyauthenticated) user name provided by the client. The current useridentifier is normally equal to the session user identifier, butmight change temporarily in the context of SECURITY DEFINERfunctions and similar mechanisms; it can also be changed bySET ROLE [\fBset_role\fR(7)].The current user identifier is relevant for permission checking..PPThe session user identifier may be changed only if the initial sessionuser (the \fIauthenticated user\fR) had thesuperuser privilege. Otherwise, the command is accepted only if itspecifies the authenticated user name..PPThe SESSION and LOCAL modifiers act the sameas for the regular SET [\fBset\fR(7)]command..PPThe DEFAULT and RESET forms reset the sessionand current user identifiers to be the originally authenticated username. These forms may be executed by any user..SH "NOTES".PP\fBSET SESSION AUTHORIZATION\fR cannot be used within aSECURITY DEFINER function..SH "EXAMPLES".sp.nfSELECT SESSION_USER, CURRENT_USER; session_user | current_user --------------+-------------- peter        | peterSET SESSION AUTHORIZATION 'paul';SELECT SESSION_USER, CURRENT_USER; session_user | current_user --------------+-------------- paul         | paul.sp.fi.SH "COMPATIBILITY".PPThe SQL standard allows some other expressions to appear in placeof the literal \fIusername\fR, but these optionsare not important in practice. PostgreSQLallows identifier syntax ("username"), which SQLdoes not. SQL does not allow this command during a transaction;PostgreSQL does not make thisrestriction because there is no reason to.The SESSION and LOCAL modifiers are aPostgreSQL extension, as is theRESET syntax..PPThe privileges necessary to execute this command are leftimplementation-defined by the standard..SH "SEE ALSO"SET ROLE [\fBset_role\fR(7)]

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?