Re: SQL function
От | Michael Glaesemann |
---|---|
Тема | Re: SQL function |
Дата | |
Msg-id | BDB9222F-5BA0-4D40-939B-E451CB47EA40@myrealbox.com обсуждение исходный текст |
Ответ на | SQL function ("Prasad dev" <esteem3300@hotmail.com>) |
Список | pgsql-novice |
On Jul 30, 2005, at 5:10 PM, Prasad dev wrote: > Sorry for mailing ya instead of the forum, earlier i had asked you > about SQL function, this what you said should work and it worked > indeed. Please don't top post, and please send replies to the mailing list. I'm cc'ing -novice. You have a much better chance at getting a helpful response if you always send to the mailing list for questions. > CREATE FUNCTION ins_both(int,int,int,int) > RETURNS void > LANGUAGE SQL AS $$ > INSERT INTO inv2 values($2,$3,$4); > INSERT INTO inv1 values($1,$2,$3); > $$; > > My problem is i have trigger which fires after insertion in Inv2, > this trigger checks for matching values in Inv1, if a matching > record is present in Inv1 then it inserts the tuple in Inv2. Is > there any way by which i can insert both tuples in tables and then > the trigger is fired for instance if i had a 'commit' as the last > line of my function then this would have fired the trigger and so on. > > Simple table structure is as follows: > create table inv2 (b int, c int, d int, primary key (b,c)); > create table inv1(a int, b int, c int, primary key (a)); I don't know much about triggers, as I haven't often needed to use them. How do you know the trigger is not firing? People who understand triggers and other such things may want to see a simplified test case (including trigger code) that shows the behavior you're seeing. Good luck! Michael Glaesemann grzm myrealbox com
В списке pgsql-novice по дате отправления: