Search Postgresql Archives

Trigger function does not modify the NEW value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx'
where  id = 1;

> 00000: lowercasing IGAL@xxxxxxxxx
> 00000:     to igal@xxxxxxxxx

select email
from   some_table
where  id = 1;

> email         |
> --------------|
> IGAL@xxxxxxxxx|

Any ideas?

Thanks,

Igal Sapir
Lucee Core Developer
Lucee.org


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux