Re: search_path not recomputed when role name changes

Lists: pgsql-bugs
From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: search_path not recomputed when role name changes
Date: 2023-07-27 18:21:25
Message-ID: 186761d32c0255debbdf50b6310b581b9c973e6c.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs


Session 1 as superuser:
CREATE USER u1;
CREATE SCHEMA u1 AUTHORIZATION u1;
GRANT ALL PRIVILEGES ON SCHEMA public TO u1;

Session 2 as u1:
SET search_path= "$user", public;
CREATE TABLE u1.x(t) AS SELECT 'data in u1.x';
CREATE TABLE public.x(t) AS SELECT 'data in public.x';
SELECT t FROM x; -- uses u1.x

Session 1 as superuser:
ALTER ROLE u1 RENAME TO u2;

Session 2 as u1:
SELECT CURRENT_USER; -- shows u2
SHOW search_path; -- $user, public
SELECT t FROM x; -- UNEXPECTED: uses u1.x still
SET search_path = public;
SET search_path TO default;
SELECT t FROM x; -- uses public.x

The fix is simple, attached.

--
Jeff Davis
PostgreSQL Contributor Team - AWS

Attachment Content-Type Size
v1-0001-Recalculate-search_path-after-ALTER-ROLE.patch text/x-patch 1.2 KB

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: search_path not recomputed when role name changes
Date: 2023-07-30 04:08:02
Message-ID: 20230730040802.GA284134@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg배트맨 토토SQL : Postg배트맨 토토SQL 메일 링리스트 : 2023-07-30 이후 PGSQL-BUGS 04:08

On Thu, Jul 27, 2023 at 11:21:25AM -0700, Jeff Davis wrote:
> The fix is simple, attached.

LGTM

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com


From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: search_path not recomputed when role name changes
Date: 2023-07-30 05:58:49
Message-ID: ZMX8GewGsnnw3U0m@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg범퍼카 토토SQL : Postg범퍼카 토토SQL 메일 링리스트 : 2023-07-30 이후 PGSQL-BUGS 05:58

On Sat, Jul 29, 2023 at 09:08:02PM -0700, Nathan Bossart wrote:
> On Thu, Jul 27, 2023 at 11:21:25AM -0700, Jeff Davis wrote:
>> The fix is simple, attached.
>
> LGTM

Is that something that should have an isolation test?
--
Michael


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>, Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: search_path not recomputed when role name changes
Date: 2023-08-02 19:09:58
Message-ID: 628b8fcc7b99bb06717a569cc91fb6436e499139.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

On Sun, 2023-07-30 at 14:58 +0900, Michael Paquier wrote:
> Is that something that should have an isolation test?

Good idea, attached.

Is there any logical ordering or grouping in the isolation_schedule? I
just added it at the end.

Regards,
Jeff Davis

Attachment Content-Type Size
v2-0001-Recalculate-search_path-after-ALTER-ROLE.patch text/x-patch 5.6 KB

From: Nathan Bossart <nathandbossart(at)gmail(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: search_path not recomputed when role name changes
Date: 2023-08-03 23:28:41
Message-ID: 20230803232841.GA1238296@nathanxps13
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 결과SQL : Postg토토 결과SQL 메일 링리스트 : 2023-08-03 이후 PGSQL-BUGS 23:28

On Wed, Aug 02, 2023 at 12:09:58PM -0700, Jeff Davis wrote:
> Is there any logical ordering or grouping in the isolation_schedule? I
> just added it at the end.

It looks like folks try to group related tests, but I don't sense any
strict ordering. It's probably fine to add it to the end. Maybe we should
alphabetize the list someday (/me braces for collation jokes).

--
Nathan Bossart
Amazon Web Services: https://aws.amazon.com


From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: search_path not recomputed when role name changes
Date: 2023-08-07 23:20:48
Message-ID: ZNF8UI8zdQZPojei@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg사설 토토SQL : Postg사설 토토SQL 메일 링리스트 : 2023-08-07 이후 PGSQL-BUGS 23:20

On Thu, Aug 03, 2023 at 04:28:41PM -0700, Nathan Bossart wrote:
> It looks like folks try to group related tests, but I don't sense any
> strict ordering. It's probably fine to add it to the end. Maybe we should
> alphabetize the list someday (/me braces for collation jokes).

Isolation tests have been added over the years in the order that a
committer and/or author saw fit at the point when it was added. There
has never been any kind of strict ordering, but there may be locations
where having a new test makes more sense than other locations.
--
Michael