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 |
Thread: | |
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 | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2023-07-27 20:38:35 | Re: Question about double table scans for a table |
Previous Message | Tom Lane | 2023-07-27 14:00:29 | Re: BUG #18038: Aliases removed from view definitions |