Re: Various PostgreSQL questions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Various PostgreSQL questions
Дата
Msg-id 22075.1021342278@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Various PostgreSQL questions  (Marc SCHAEFER <schaefer@alphanet.ch>)
Ответы Re: Various PostgreSQL questions  (Marc SCHAEFER <schaefer@alphanet.ch>)
Список pgsql-sql
Marc SCHAEFER <schaefer@alphanet.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


В списке pgsql-sql по дате отправления:

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: Various PostgreSQL questions
Следующее
От: Mathieu Arnold
Дата:
Сообщение: order by