From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Marc SCHAEFER <schaefer(at)alphanet(dot)ch> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Various PostgreSQL questions |
Date: | 2002-05-14 02:11:18 |
Message-ID: | 22075.1021342278@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Marc SCHAEFER <schaefer(at)alphanet(dot)ch> writes:
> Version: 7.1release-3.potato.1 (Debian package of 7.1release-3)
> Question 1:
> Apparently using NUMERIC(10, 2) in a type definition (DECLARE) of
> a stored procedure in PL/pgSQL doesn't work; FLOAT works instead.
I believe this is fixed in 7.2.
> Question 2:
> How can I implement a constraint which would always ensure the
> SUM(money_amount) WHERE type = 1 in a specified table is always
> zero ?
I would think you'd want your function to run AFTER INSERT not
BEFORE INSERT.
> The following works, once. The second time it doesn't work (in the
> same session/backend, see below for the error).
If you want to build dynamically-modified queries in plpgsql, you need
to use EXECUTE. That includes references to tables that you're dropping
and recreating between calls of the function.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | juerg.rietmann | 2002-05-14 09:29:01 | date_part, how to use |
Previous Message | Christopher Kings-Lynne | 2002-05-14 01:47:51 | Re: Various PostgreSQL questions |