Re: 'plpgsql' oddity

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Mitch Vincent" <mitch(at)venux(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: 'plpgsql' oddity
Date: 2001-01-23 02:50:09
Message-ID: 26874.980218209@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Mitch Vincent" <mitch(at)venux(dot)net> writes:
> CREATE FUNCTION invoice_payment() RETURNS OPAQUE AS '
> BEGIN

> UPDATE invoice_master SET total = total - NEW.amount,updated = ''now''
> WHERE invoice_id = NEW.invoice_id;

> RETURN NEW;

> END;
> ' LANGUAGE 'plpgsql';

> total gets updated but the field 'updated' does not

Try updated = now(). The above is probably reducing 'now' to a
timestamp constant when the function is compiled ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2001-01-23 02:57:47 Re: 'plpgsql' oddity
Previous Message tc lewis 2001-01-23 02:46:46 pleasing the corporate-types.