From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Durumdara <durumdara(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Can I start Update row in After Insert trigger function? |
Date: | 2022-05-24 15:27:04 |
Message-ID: | d7c45d13-f09f-08af-b5d4-191364ab43dd@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 5/23/22 23:17, Durumdara wrote:
> Dear Adrian!
>
> Thank you for the information. For me the main question is that:
> Can I execute an UPDATE in the AFTER INSERT trigger procedure?
> Or is this confuses PGSQL, because prior operation (INSERT) isn't fully
> finished?
It is spelled out here:
https://www.postgresql.org/docs/current/sql-createtrigger.html
"The trigger can be specified to fire before the operation is attempted
on a row (before constraints are checked and the INSERT, UPDATE, or
DELETE is attempted); or after the operation has completed (after
constraints are checked and the INSERT, UPDATE, or DELETE has
completed); or instead of the operation (in the case of inserts, updates
or deletes on a view)."
So the INSERT has completed in an AFTER trigger.
>
> Thank you!
>
> BR,
> dd
>
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Matthias Apitz | 2022-05-24 15:42:26 | Re: existing row not found by SELECT ... WHERE CTID = ? |
Previous Message | Tom Lane | 2022-05-24 14:47:11 | Re: existing row not found by SELECT ... WHERE CTID = ? |