Re: 'plpgsql' oddity - Mailing list pgsql-general

From Tom Lane
Subject Re: 'plpgsql' oddity
Date
Msg-id 26874.980218209@sss.pgh.pa.us
Whole thread Raw
In response to 'plpgsql' oddity  ("Mitch Vincent" <mitch@venux.net>)
List pgsql-general
"Mitch Vincent" <mitch@venux.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

pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: MySQL -> Postgres dump converter
Next
From: Stephan Szabo
Date:
Subject: Re: 'plpgsql' oddity