Re: In which session context is a trigger run?

From: Mitar <mmitar(at)gmail(dot)com>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: In which session context is a trigger run?
Date: 2018-12-29 07:44:38
Message-ID: CAKLmikNq72rSKXj2EcoDKESCtmx2xxYDhfvFk2ZJ3MMDA5drGg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

On Fri, Dec 28, 2018 at 9:36 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mitar 2018-12-29 08:07:22 Using placeholders when creating a materialized view
Previous Message patrick keshishian 2018-12-29 07:37:55 Re: libpq bug?