Re: GRANT CONNECT ON DATABASE

From: Edwin UY <edwin(dot)uy(at)gmail(dot)com>
To: soroush jurat <srsh(dot)jurat(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: GRANT CONNECT ON DATABASE
Date: 2024-06-10 01:02:49
Message-ID: CA+wokJ8Vw_QD6p6HwPoDtyK_FTjwz3XCZJW1O4DornmcAx9Ssw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks for the clarification.

On Mon, Jun 10, 2024 at 12:35 PM soroush jurat <srsh(dot)jurat(at)gmail(dot)com> wrote:

> The GRANT CONNECT statement allows the role to connect to the database but
> does not give it login permission either.
>
> So, you need both the ALTER ROLE and GRANT CONNECT statements to ensure
> the role can log in and connect to the database.
>
> Jurat
>
> On Sun, 9 Jun 2024 at 20:27 Edwin UY <edwin(dot)uy(at)gmail(dot)com> wrote:
>
>> Thanks. Yeah, the ALTER fixed it.
>> I thought the CONNECT should have done the same thing.
>> Is the GRANT CONNECT not necessary then?
>>
>> On Mon, Jun 10, 2024 at 12:14 PM soroush jurat <srsh(dot)jurat(at)gmail(dot)com>
>> wrote:
>>
>>> To grant the role login access, you need to modify the role to have the
>>> LOGIN attribute. You can do this by running the following command:
>>>
>>> ALTER ROLE [blah] WITH LOGIN;
>>>
>>>
>>>
>>> On Sun, 9 Jun 2024 at 20:09 Edwin UY <edwin(dot)uy(at)gmail(dot)com> wrote:
>>>
>>>> Hi,
>>>>
>>>> A role was created as below:
>>>> CREATE ROLE [blah] WITH NOLOGIN NOSUPERUSER INHERIT NOCREATEDB
>>>> NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';
>>>>
>>>> Doesn't the following SQLs supposed to give the role login access?
>>>>
>>>> ALTER ROLE [blah] WITH ENCRYPTED PASSWORD 'blahpassword' ;
>>>> GRANT CONNECT ON DATABASE [blahdb] TO [blahuser] ;
>>>>
>>>> We're trying to take the minimalist approach for a user access to have
>>>> access to only the tables he has created and only to a specific database
>>>> and schema.
>>>>
>>>> Regards,
>>>> Ed
>>>>
>>>>
>>>>

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Muhammad Ikram 2024-06-10 07:41:06 Re: How to find the view modified date and time and user name
Previous Message soroush jurat 2024-06-10 00:34:49 Re: GRANT CONNECT ON DATABASE