Re: function return value inside a trigger function
От | joao tiago a. m. viegas |
---|---|
Тема | Re: function return value inside a trigger function |
Дата | |
Msg-id | CA+5hQH3T_PhTkDhzfZYrnUhy5GVBPjVfgzozTY+eCE06SUzqMw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: function return value inside a trigger function (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
sorry for the late update
thank you all,I found the cause, that specific sentence was correct, it was in another sentence of the same function, I think it was late at night and I was tired.
thank you anyway
best regards
jtv
On 27 September 2012 02:26, Tom Lane <tgl@sss.pgh.pa.us> wrote:
joao viegas <jtamviegas@yahoo.co.uk> writes:Works for me ...
> does anybody knows how can I have something like:
> select function_that_returns_int(NEW.field1) into NEW.field2;
create table fooey (q1 int, q2 int);
create function myt() returns trigger language plpgsql as $$
begin
select abs(new.q1) into new.q2;
return new;
end$$;
create trigger mytrig before insert on fooey for each row
execute procedure myt();
insert into fooey values(-42, 77);
select * from fooey;
q1 | q2
-----+----
-42 | 42
(1 row)
Perhaps you should show a full example of what you're doing.
regards, tom lane
В списке pgsql-general по дате отправления: