Trigger function volatility - Mailing list pgsql-novice

From Tyler Mitchell
Subject Trigger function volatility
Date
Msg-id Pine.NEB.4.64.0908040323120.7569@fury.overtheedge.ca
Whole thread Raw
Responses Re: Trigger function volatility  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-novice
I have some data that I would like to store in lowercase, and so I've
created a function and a trigger:


create or replace function gl_lower() returns trigger as $$
begin
     new.sender := lower(new.sender);
     new.recipient := lower(new.recipient);
     return new;
end;
$$ language plpgsql;
create trigger gl_lower
     before insert or update on gl_exemptions
     for each row execute procedure gl_lower();


I'm wondering, though, if I can declare it IMMUTABLE. The function itself
doesn't query the database or modify the database directly. Potentially
the data which is about to be inserted/updated gets modified, but my
understanding is that the new data isn't committed until all of the before
triggers are processed.

Can anyone think of any issues with IMMUTABLE in this case? Will there be
any noticeable benefit? My initial tests thus far have all passed.

Kindest regards,

--
Tyler

pgsql-novice by date:

Previous
From: Lennin Caro
Date:
Subject: Re: Graphical user interface
Next
From: Lacey Powers
Date:
Subject: Re: Where can I find the PostgreSQL 8.2.5 binaries?