Re: Cascade delete triggers change user credentials - Mailing list pgsql-general

From Tom Lane
Subject Re: Cascade delete triggers change user credentials
Date
Msg-id 10290.1077029865@sss.pgh.pa.us
Whole thread Raw
In response to Re: Cascade delete triggers change user credentials  (Antonios Christofides <anthony@itia.ntua.gr>)
Responses Re: Cascade delete triggers change user credentials  (Antonios Christofides <anthony@itia.ntua.gr>)
List pgsql-general
Antonios Christofides <anthony@itia.ntua.gr> writes:
> In PostgreSQL there are actually up to THREE users active, not two:
>   - The user who connected, which I shall call "connected user".
>   - The user who became effective as the result of "alter session
>     authorization" command. This is the user returned by session_user.
>   - The user who is applicable for permission checking, current_user.

> If you try to "alter session authorization", PostgreSQL uses the
> "connected user" to determine whether you have permission to do so (or,
> at least, remembers that you initially connected as superuser). The
> current user is used in most other cases of permission checking.

[ looks at code... ]  It does remember the original userid (which is
called AuthenticatedUser in the code), but AFAICT the only thing that
is actually used is knowledge of whether that userid is a superuser.

> The 7.4 manual, however, says that the session_user "is the user that
> initiated a database connection", and fails to mention "alter session
> authorization". Is the manual in error or the implementation?

The manual could stand improvement, evidently.  I think this stuff is
correctly described in the vicinity of SET SESSION AUTHORIZATION, but
the status-function documentation sounds like it needs work.  Feel free
to send in a docs patch ...

            regards, tom lane

pgsql-general by date:

Previous
From: Eric Ridge
Date:
Subject: Re: ps output and postgres
Next
From: Brendan Jurd
Date:
Subject: Re: psql, 7.4, and the \d command