From: | ALT SHN <i(dot)geografica(at)alt-shn(dot)org> |
---|---|
To: | Christian Barthel <bch(at)online(dot)de> |
Cc: | pgsql-novice(at)lists(dot)postgresql(dot)org |
Subject: | Re: Coalesce in PostgreSQL trigger does not fire on upddate |
Date: | 2020-02-08 09:32:20 |
Message-ID: | CAGFOAzzUY7fgCX=XhQA5Aq0p2wHUNz9vs7NR90y47=BiipaOMQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)online(dot)de> escreveu no dia sábado, 8/02/2020 à(s)
08:53:
> ALT SHN <i(dot)geografica(at)alt-shn(dot)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(at)online(dot)de>
>
--
---------------------------------------------------------------
*Sociedade de História Natural*
Departamento de Informação Geográfica
Polígono Industrial do Alto do Amial
Pav.H02 e H06
i(dot)geografica(at)alt-shn(dot)org <laboratorio(at)alt-shn(dot)org>
www.shn.pt
www.alt-shn.blogspot.com
Facebook <https://www.facebook.com/SociedadeDeHistoriaNatural?ref=hl>
TLM: 964138188
From | Date | Subject | |
---|---|---|---|
Next Message | William Colls | 2020-02-08 22:39:32 | Where condition doesn't work as expected |
Previous Message | Christian Barthel | 2020-02-08 07:53:39 | Re: Coalesce in PostgreSQL trigger does not fire on upddate |