Re: Coalesce in PostgreSQL trigger does not fire on upddate

Поиск
Список
Период
Сортировка
От ALT SHN
Тема Re: Coalesce in PostgreSQL trigger does not fire on upddate
Дата
Msg-id CAGFOAzzUY7fgCX=XhQA5Aq0p2wHUNz9vs7NR90y47=BiipaOMQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Coalesce in PostgreSQL trigger does not fire on upddate  (Christian Barthel <bch@online.de>)
Список pgsql-novice
Thanks Christian,

Yes there is another update trigger that seems to be interfering. I updated the question with the details of this second trigger here: https://stackoverflow.com/questions/60117123/coalesce-in-postgresql-trigger-does-not-fire-on-update

Christian Barthel <bch@online.de> escreveu no dia sábado, 8/02/2020 à(s) 08:53:
ALT SHN <i.geografica@alt-shn.org> writes:

[..]
> However this trigger only fires on INSERT, nothing happens if
> an UPDATE is made. How can have this trigger also firing in the
> case of an UPDATE?

I have just tested it on PostgreSQL 11 (FreeBSD) and it seems to
work (at least, it is what I would expect):


bch=# select id,taxon,reino,phylum,subphylum,classe,especie from
 taxon where id = 3;
 id | taxon | reino | phylum | subphylum | classe | especie
----+-------+-------+--------+-----------+--------+---------
(0 rows)

bch=# insert into taxon(reino,classe) values ('1', '2');
INSERT 0 1
bch=# select id,taxon,reino,phylum,subphylum,classe,especie from
taxon where id = 3;
 id | taxon | reino | phylum | subphylum | classe | especie
----+-------+-------+--------+-----------+--------+---------
  3 | 2     | 1     |        |           | 2      |
(1 row)

bch=# update taxon set especie='99' where id = 3;
UPDATE 1
bch=# select id,taxon,reino,phylum,subphylum,classe,especie from
taxon where id = 3;
 id | taxon | reino | phylum | subphylum | classe | especie
----+-------+-------+--------+-----------+--------+---------
  3 | 99    | 1     |        |           | 2      | 99
(1 row)

Are there any other triggers preventing the update?  You may also
write some RAISE NOTICE messages into the trigger to see when it
is being executed.

--
Christian Barthel <bch@online.de>


--
---------------------------------------------------------------


Sociedade de História Natural
Departamento de Informa
ção Geográfica
Polígono Industrial do Alto do Amial
Pav.H02 e H06


i.geografica@alt-shn.org
www.shn.pt
www.alt-shn.blogspot.com

В списке pgsql-novice по дате отправления:

Предыдущее
От: Christian Barthel
Дата:
Сообщение: Re: Coalesce in PostgreSQL trigger does not fire on upddate
Следующее
От: William Colls
Дата:
Сообщение: Where condition doesn't work as expected