Re: Wrong security context for deferred triggers? - Mailing list pgsql-hackers

From Joseph Koshakow
Subject Re: Wrong security context for deferred triggers?
Date
Msg-id CAAvxfHecV=O-HYo=3zeG0w9YiRmiZBOvLgZ+ZZDh_E1xCyc-BQ@mail.gmail.com
Whole thread Raw
In response to Re: Wrong security context for deferred triggers?  (Joseph Koshakow <koshy44@gmail.com>)
List pgsql-hackers
On Sat, Jun 8, 2024 at 5:36 PM Joseph Koshakow <koshy44@gmail.com> wrote:

>    Additionally, I applied your patch to master and re-ran the example and
>    didn't notice any behavior change.
>
>        test=# CREATE TABLE tab (i integer);
>        CREATE TABLE
>        test=# CREATE FUNCTION trig() RETURNS trigger
>            LANGUAGE plpgsql AS
>         $$BEGIN
>            RAISE NOTICE 'current_user = %', current_user;
>            RETURN NEW;
>         END;$$;
>        CREATE FUNCTION
>        test=# CREATE CONSTRAINT TRIGGER trig AFTER INSERT ON tab
>            DEFERRABLE INITIALLY IMMEDIATE
>            FOR EACH ROW EXECUTE FUNCTION trig();
>        CREATE TRIGGER
>        test=# CREATE ROLE duff;
>        CREATE ROLE
>        test=# GRANT INSERT ON tab TO duff;
>        GRANT
>        test=# SET ROLE duff;
>        SET
>        test=> BEGIN;
>        BEGIN
>        test=*> INSERT INTO tab VALUES (1);
>        NOTICE:  current_user = duff
>        INSERT 0 1
>        test=*> SET CONSTRAINTS ALL DEFERRED;
>        SET CONSTRAINTS
>        test=*> INSERT INTO tab VALUES (2);
>        INSERT 0 1
>        test=*> RESET ROLE;
>        RESET
>        test=*# COMMIT;
>        NOTICE:  current_user = joe
>        COMMIT
>
>    Though maybe I'm just doing something wrong.

Sorry, there's definitely something wrong with my environment. You can
ignore this.

Thanks,
Joe Koshakow

pgsql-hackers by date:

Previous
From: "David E. Wheeler"
Date:
Subject: Shouldn't jsonpath .string() Unwrap?
Next
From: Isaac Morland
Date:
Subject: Re: Wrong security context for deferred triggers?