From: | Michael Glaesemann <grzm(at)myrealbox(dot)com> |
---|---|
To: | "Prasad dev" <esteem3300(at)hotmail(dot)com> |
Cc: | PostgreSQL Novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: SQL function |
Date: | 2005-07-30 08:33:03 |
Message-ID: | BDB9222F-5BA0-4D40-939B-E451CB47EA40@myrealbox.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ron Arts | 2005-07-30 18:37:29 | change column length, is it that hard? |
Previous Message | Michael Fuhr | 2005-07-29 02:39:25 | Re: Troubles with PL/Perl in PgSQL |