From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Dominique Devienne <ddevienne@gmail.com>
To: Lok P <loknath.73@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: Users and object privileges maintenance
Date: Sun, 18 Feb 2024 09:02:57 -0800
Message-ID: <d48e9d9e-dee7-4410-86f4-92049d064ca8@aklaver.com> (raw)
In-Reply-To: <CAFCRh--DFkh0YaUZ=0c+BRQPHy8Z4Bzvd9B7cBTR-r05=EfJLA@mail.gmail.com>
References: <CAKna9VbjA+2t-st_cxBMhXbAes6HXOR7z=x3Y9QFdkB9VdE8ww@mail.gmail.com>
<CAFCRh--DFkh0YaUZ=0c+BRQPHy8Z4Bzvd9B7cBTR-r05=EfJLA@mail.gmail.com>
On 2/18/24 02:12, Dominique Devienne wrote:
> On Sat, Feb 17, 2024 at 10:50 PM Lok P <loknath.73@gmail.com
> <mailto:loknath.73@gmail.com>> wrote:
>
> We were having past experience in Oracle and are newly getting moved
> to postgres database. [...]
> So I just wanted to understand if these grants and privileges for
> objects/users are given and maintained in a similar way in postgres
> database
>
>
> Yes they are. Having done that move from Oracle to PostgreSQL, here are
> a few pointers.
>
More information on a couple of points I have found trips people up on
occasion.
>
> "DBAs" in PostgreSQL are ROLEs with the SUPERUSER privilege. (e.g. the
> built-in postgres ROLE)
This is a convention not a rule. More specifically it is the name of the
OS user that runs initdb. It can be overridden by using -U <some_name)
with initdb. I bring it up because this causes confusion, in particular
with the folks using the Homebrew and Postgres.app packages found here:
https://www.postgresql.org/download/macosx/
In those cases the default superuser generally is the name of the OS
user that downloaded and installed the package.
>
> USERs are ROLEs with the LOGIN privilege.
Again a convention not a rule. This harks back to the days(v 8.0-) when
Postgres had groups and users.
Per
https://www.postgresql.org/docs/current/sql-createuser.html
"CREATE USER is now an alias for CREATE ROLE. The only difference is
that when the command is spelled CREATE USER, LOGIN is assumed by
default, whereas NOLOGIN is assumed when the command is spelled CREATE
ROLE."
It is entirely possible to CREATE USER ... WITH NOLOGIN ...
--
Adrian Klaver
adrian.klaver@aklaver.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, ddevienne@gmail.com, loknath.73@gmail.com
Subject: Re: Users and object privileges maintenance
In-Reply-To: <d48e9d9e-dee7-4410-86f4-92049d064ca8@aklaver.com>
References: <CAKna9VbjA+2t-st_cxBMhXbAes6HXOR7z=x3Y9QFdkB9VdE8ww@mail.gmail.com> <CAFCRh--DFkh0YaUZ=0c+BRQPHy8Z4Bzvd9B7cBTR-r05=EfJLA@mail.gmail.com> <d48e9d9e-dee7-4410-86f4-92049d064ca8@aklaver.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