'plpgsql' oddity

From: "Mitch Vincent" <mitch(at)venux(dot)net>
To: <pgsql-general(at)postgresql(dot)org>
Subject: 'plpgsql' oddity
Date: 2001-01-23 01:34:22
Message-ID: 008701c084dc$9d0cb0a0$0200000a@windows
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is probably something I'm doing (or not doing) but I can't seem to
figure out what it is... I have been playing with this little function :

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';

.. and this trigger :

CREATE TRIGGER invoice_trigger AFTER INSERT ON invoice_payments
FOR EACH ROW EXECUTE PROCEDURE invoice_payment();

The first field to be updated (total to total - amount) works just fine but
anything I put after that simply doesn't happen, it's very strange.. In the
above example, total gets updated but the field 'updated' does not, yet the
query does run (and correctly as far as the total field goes) so I'm
assuming there isn't a parse error or anything..

Can someone smack me with a clue stick?

Thanks!

-Mitch

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Paul M Foster 2001-01-23 01:45:24 Re: Data entry screen building utilities
Previous Message Bruce Momjian 2001-01-23 00:49:58 Re: OID/XID allocation (was Re: is PG able to handle a >500 GB Da tabase?)