search_path not recomputed when role name changes

Поиск
Список
Период
Сортировка
Искать

search_path not recomputed when role name changes

От:
Jeff Davis <pgsql@j-davis.com>
Дата:
Вложения:

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


Re: search_path not recomputed when role name changes

От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
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


Re: search_path not recomputed when role name changes

От:
Michael Paquier <michael@paquier.xyz>
Дата:
Вложения:
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

Re: search_path not recomputed when role name changes

От:
Jeff Davis <pgsql@j-davis.com>
Дата:
Вложения:
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

Re: search_path not recomputed when role name changes

От:
Nathan Bossart <nathandbossart@gmail.com>
Дата:
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


Re: search_path not recomputed when role name changes

От:
Michael Paquier <michael@paquier.xyz>
Дата:
Вложения:
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
FAQ