| From: | Robert <robert(at)robert(dot)cz> |
|---|---|
| To: | pgsql-general(at)postgreSQL(dot)org |
| Subject: | Numeric type in PL/pgSQL trigger: overflow problem |
| Date: | 2000-02-20 17:56:13 |
| Message-ID: | 38B02ABD.B2EEDAEB@robert.cz |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
following function doesn't work with numeric type, when I change type
of 'total_no_vat' to anything else incl. float it works OK. What am I
doing wrong? Thanks for your help.
- Robert
CREATE TABLE deb_invoice_line_table (
qty NUMERIC(13,2),
unit_price NUMERIC(13,2),
total_no_vat NUMERIC(13,2),
-- ...
)
CREATE FUNCTION deb_invoice_line_complete() RETURNS OPAQUE AS 'BEGIN
NEW.total_no_vat := 5.2;
RETURN NEW;
END;' LANGUAGE 'plpgsql';
CREATE TRIGGER deb_invoice_line_trigger
BEFORE INSERT OR UPDATE
ON deb_invoice_line_table
FOR EACH ROW EXECUTE PROCEDURE deb_invoice_line_complete();
INSERT INTO deb_invoice_line_table (qty,unit_price) VALUES (3,33);
ERROR: overflow on numeric ABS(value) >= 10^0 for field with precision
0 scale 2
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Bruce Staples (ENZ) | 2000-02-20 19:58:12 | unsubscribe |
| Previous Message | Ed Loehr | 2000-02-20 16:20:51 | Re: [GENERAL] Backend terminated abnormally error ? |