On Tue, 04 Nov 2003, Tom Lane wrote:
> Jamie Lawrence <[EMAIL PROTECTED]> writes:
> > I don't understand why moddate isn't getting set to now() in the above.
>
> Josh fingered the problem there --- you need a BEFORE trigger if you
> want to affect the data that will be stored. I had missed that
Jamie Lawrence <[EMAIL PROTECTED]> writes:
> I don't understand why moddate isn't getting set to now() in the above.
Josh fingered the problem there --- you need a BEFORE trigger if you
want to affect the data that will be stored. I had missed that little
mistake :-(
rega
On Tue, 04 Nov 2003, Tom Lane wrote:
> Jamie Lawrence <[EMAIL PROTECTED]> writes:
> > I had thought that if moddate isn't included in an insert or update,
> > that it would be null in the NEW context,
>
> No, it would be whatever the value to be assigned to the column would
> be, if the trigger w
Jamie,
> Any thoughts on what I'm doing wrong??
Yes. If you want to modify the new data, you need to use a BEFORE trigger.
AFTER triggers can't modify NEW, just read it.
--
-Josh Berkus
Aglio Database Solutions
San Francisco
---(end of broadcast)--
Jamie Lawrence <[EMAIL PROTECTED]> writes:
> I had thought that if moddate isn't included in an insert or update,
> that it would be null in the NEW context,
No, it would be whatever the value to be assigned to the column would
be, if the trigger were not present. In particular, during an UPDATE
Hi folks -
I'm having a problem with what looks like it should be trivial.
For the function
create or replace function timestamp_fn() returns opaque as '
begin
NEW.moddate := coalesce(NEW.moddate, now());
return NEW;
end
' language 'plpgsql';
on an after insert