Skip to content

Commit babf8f1

Browse files
committed
Document current_role.
This system function has been there a very long time, but somehow escaped being listed in func.sgml. Fabien Coelho and Tom Lane Discussion: https://postgr.es/m/alpine.DEB.2.20.1705061027580.3896@lancre
1 parent f692583 commit babf8f1

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

doc/src/sgml/func.sgml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13440,6 +13440,12 @@ postgres=# SELECT * FROM unnest2(ARRAY[[1,2],[3,4]]);
1344013440
by the client (might contain more than one statement)</entry>
1344113441
</row>
1344213442

13443+
<row>
13444+
<entry><literal><function>current_role</function></literal></entry>
13445+
<entry><type>name</type></entry>
13446+
<entry>equivalent to <function>current_user</function></entry>
13447+
</row>
13448+
1344313449
<row>
1344413450
<entry><literal><function>current_schema</function>[()]</literal></entry>
1344513451
<entry><type>name</type></entry>
@@ -13551,8 +13557,11 @@ postgres=# SELECT * FROM unnest2(ARRAY[[1,2],[3,4]]);
1355113557

1355213558
<note>
1355313559
<para>
13554-
<function>current_catalog</function>, <function>current_schema</function>,
13555-
<function>current_user</function>, <function>session_user</function>,
13560+
<function>current_catalog</function>,
13561+
<function>current_role</function>,
13562+
<function>current_schema</function>,
13563+
<function>current_user</function>,
13564+
<function>session_user</function>,
1355613565
and <function>user</function> have special syntactic status
1355713566
in <acronym>SQL</acronym>: they must be called without trailing
1355813567
parentheses. (In PostgreSQL, parentheses can optionally be used with
@@ -13572,6 +13581,10 @@ postgres=# SELECT * FROM unnest2(ARRAY[[1,2],[3,4]]);
1357213581
<primary>current_query</primary>
1357313582
</indexterm>
1357413583

13584+
<indexterm>
13585+
<primary>current_role</primary>
13586+
</indexterm>
13587+
1357513588
<indexterm>
1357613589
<primary>current_schema</primary>
1357713590
</indexterm>
@@ -13623,6 +13636,11 @@ postgres=# SELECT * FROM unnest2(ARRAY[[1,2],[3,4]]);
1362313636
functions with the attribute <literal>SECURITY DEFINER</literal>.
1362413637
In Unix parlance, the session user is the <quote>real user</quote> and
1362513638
the current user is the <quote>effective user</quote>.
13639+
<function>current_role</function> and <function>user</function> are
13640+
synonyms for <function>current_user</function>. (The SQL standard draws
13641+
a distinction between <function>current_role</function>
13642+
and <function>current_user</function>, but <productname>PostgreSQL</>
13643+
does not, since it unifies users and roles into a single kind of entity.)
1362613644
</para>
1362713645

1362813646
<para>

0 commit comments

Comments
 (0)