pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Westermann <daniel.westermann@dbi-services.com>
To: pgsql-docs@lists.postgresql.org
Subject: docs: set role permission checking, do I read this wrong?
Date: Wed, 18 Oct 2023 09:05:18 +0200
Message-ID: <93e0bf53-41ae-4718-a1c5-cec36283bbc7@dbi-services.com> (raw)

Hi,

when reading the documentation about "set role" there is this:
https://www.postgresql.org/docs/16/sql-set-role.html

"After |SET ROLE|, permissions checking for SQL commands is carried out 
as though the named role were the one that had logged in originally."

Given this:

postgres=# select session_user, current_user;
  session_user | current_user
--------------+--------------
  postgres     | postgres
(1 row)

postgres=# set role a;
SET
postgres=> create table t(a int);
ERROR:  permission denied for schema public
LINE 1: create table t(a int);
                      ^
Isn't it the other way around and permission checking is done as "a", or 
do I read this wrong?

Best regards
Daniel





view thread (4+ messages)  latest in thread

Message-ID: <93e0bf53-41ae-4718-a1c5-cec36283bbc7@dbi-services.com>
Permalink:  ../93e0bf53-41ae-4718-a1c5-cec36283bbc7@dbi-services.com/
Also on:    postgresql.org/message-id/93e0bf53-41ae-4718-a1c5-cec36283bbc7@dbi-services.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: daniel.westermann@dbi-services.com, pgsql-docs@lists.postgresql.org
  Subject: Re: docs: set role permission checking, do I read this wrong?
  In-Reply-To: <93e0bf53-41ae-4718-a1c5-cec36283bbc7@dbi-services.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox