1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Implement differentiation between CURRENT_USER and SESSION_USER as per SQL.

There is still no effective difference but it will kick in once setuid
functions exist (not included here).  Make old getpgusername() alias for
current_user.
This commit is contained in:
Peter Eisentraut
2000-09-19 18:18:04 +00:00
parent e9c3f0255f
commit 457ac0331c
12 changed files with 166 additions and 65 deletions

View File

@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.35 2000/08/29 20:02:07 momjian Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.36 2000/09/19 18:17:53 petere Exp $
-->
<chapter id="datatype">
@ -211,11 +211,6 @@ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.35 2000/08/29 20:02:07 mo
</row>
</thead>
<tbody>
<row>
<entry>getpgusername()</entry>
<entry>current_user</entry>
<entry>user name in current session</entry>
</row>
<row>
<entry>date('now')</entry>
<entry>current_date</entry>

View File

@ -1509,6 +1509,61 @@ Not defined by this name. Implements the intersection operator '#'
</sect1>
<sect1>
<title id="misc-funcs">Miscellaneous Functions</>
<table>
<title>Miscellaneous Functions</>
<tgroup cols="3">
<thead>
<row><entry>Name</> <entry>Return type</> <entry>Description</></row>
</thead>
<tbody>
<row>
<entry>current_user</>
<entry>name</>
<entry>user name of current execution context</>
</row>
<row>
<entry>user</>
<entry>name</>
<entry>equivalent to <function>current_user</></>
</row>
<row>
<entry>session_user</>
<entry>name</>
<entry>session user name</>
</row>
</tbody>
</tgroup>
</table>
<para>
The <function>session_user</> is the user that initiated a database
connection and is fixed for the duration of that connection. The
<function>current_user</> is the user identifier that is applicable
for permission checking. Currently it is always equal to the session
user, but in the future there might be <quote>setuid</> functions and
other facilities to allow the current user to change temporarily.
In Unix parlance, the session user is the <quote>real user</>
and the current user is the <quote>effective user</>.
</para>
<para>
Note that these functions have special syntactic status in <acronym>SQL</>;
they must be called without trailing parentheses.
</para>
<note>
<title>Deprecated</>
<para>
The function <function>getpgusername()</> is an obsolete equivalent
of <function>current_user</>.
</para>
</note>
</sect1>
<sect1>
<title id="aggregate-funcs">Aggregate Functions</title>