Re: In which session context is a trigger run? - Mailing list pgsql-general

From Mitar
Subject Re: In which session context is a trigger run?
Date
Msg-id CAKLmikNq72rSKXj2EcoDKESCtmx2xxYDhfvFk2ZJ3MMDA5drGg@mail.gmail.com
Whole thread Raw
In response to Re: In which session context is a trigger run?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: In which session context is a trigger run?  (Adrian Klaver <adrian.klaver@aklaver.com>)
In which session context is a trigger run?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
Hi!

On Fri, Dec 28, 2018 at 9:36 PM Adrian Klaver <adrian.klaver@aklaver.com> wrote:
> When you create the temporary function it is 'pinned' to a particular
> session/pg_temp_nn. Running the trigger in another session 'pins' it to
> that session and it is not able to see the posts_temp table in the
> original session.

Yes. But why is trigger run in that other session? Could there be a
way to get trigger to run in the session where it was declared?

And yes, global temporary tables would be another approach to solve
this. But being able to set the session could be another, no? Or are
sessions linked to OS processes PostgreSQL is using and this is why
triggers run based on the session in which a change on the table was
made?


Mitar

-- 
http://mitar.tnode.com/
https://twitter.com/mitar_m


pgsql-general by date:

Previous
From: patrick keshishian
Date:
Subject: Re: libpq bug?
Next
From: Mitar
Date:
Subject: Using placeholders when creating a materialized view