search_path not recomputed when role name changes - Mailing list pgsql-bugs

From Jeff Davis
Subject search_path not recomputed when role name changes
Date
Msg-id 186761d32c0255debbdf50b6310b581b9c973e6c.camel@j-davis.com
Whole thread Raw
Responses Re: search_path not recomputed when role name changes
List 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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #18038: Aliases removed from view definitions
Next
From: David Rowley
Date:
Subject: Re: Question about double table scans for a table