Trigger function does not modify the NEW value

Поиск
Список
Период
Сортировка
От Igal @ Lucee.org
Тема Trigger function does not modify the NEW value
Дата
Msg-id 04592c40-829d-a31e-790a-96afbc108c0a@lucee.org
обсуждение исходный текст
Ответы Re: Trigger function does not modify the NEW value  (David Rowley <david.rowley@2ndquadrant.com>)
Список pgsql-general

I have a trigger that is created like so:

    create trigger tr_on_table_modified after insert or delete or update
        on some_table for each row execute procedure on_table_modified();

    CREATE OR REPLACE FUNCTION on_table_modified() RETURNS trigger LANGUAGE plpgsql $$
        /* some code that does not modify any values but calls PERFORM on another function */
       
        raise notice 'lowercasing %', new.email;
        new.email = lower(new.email);
        raise notice '    to %', new.email;

        return new;
    $$

I can see in the output the notices with the expected values, but the value in the updated record is not lower-cased.

update some_table
set    email = 'IGAL@Lucee.org'
where  id = 1;

> 00000: lowercasing IGAL@Lucee.org
> 00000:     to igal@lucee.org

select email
from   some_table
where  id = 1;

> email         |
> --------------|
> IGAL@Lucee.org|

Any ideas?

Thanks,

Igal Sapir
Lucee Core Developer
Lucee.org

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Re: Re: Enabling checksums on a streaming replica
Следующее
От: David Rowley
Дата:
Сообщение: Re: Trigger function does not modify the NEW value