Triggers problem

------=_Part_21470_3410762.1128505392155
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

i have a problem in triggers for that bellow is my table structure

survey table
<pgsql-php [at] postgresql.org>survey_id

questions table
question_id
survey_id

answer_options table
answer_option_id
question_id


now the problem is
i want to write a trigger after insert on survey table data should be
inserted in questions and answer options table
i get survey_id by new.survey_id but in same function i am not getting
question_id to insert in answer option for newly inserted questions as the
trigger is on insert of survey table
i don't want to use cascaded triggers because it is creating some more
problems
please guide me in this regards

------=_Part_21470_3410762.1128505392155
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

i have a problem in triggers for that bellow is my table structure<br>
<br>
<span style=3D"font-weight: bold;">survey table<br>
</span><a onclick=3D"return top.js.OpenExtLink(window,event,this)" href=3D"=
mailto:pgsql-php [at] postgresql.org"><span id=3D"st" name=3D"st" class=3D"st0">=
</span></a>survey_id<br>
<br>
<span style=3D"font-weight: bold;">questions table<br>
<span style=3D"font-weight: bold;"></span></span>question_id<br>
survey_id<br>
<br>
<span style=3D"font-weight: bold;">answer_options table<br>
</span>answer_option_id<br>
question_id<br>
<br>
<br>
now the problem is <br>
i want to write a trigger after insert on survey table data should be inser=
ted in questions and answer options table<br>
i get survey_id  by new.survey_id but in same function i am not
getting question_id to insert in answer option for newly inserted
questions as the trigger is on insert of survey table <br>
i don't want to use cascaded triggers because it is creating some more prob=
lems<br clear=3D"all">
please guide me in this regards<br>
<br>
<span style=3D"font-weight: bold;"></span><br>


------=_Part_21470_3410762.1128505392155--
Ninad Kalamkar [ Mi, 05 Oktober 2005 11:43 ] [ ID #998002 ]

Re: Triggers problem

You're more likely to get a response to this on -general than here.

Why are you trying to do this with a trigger? ISTM that with what you're
trying to do you should be using a stored procedure.

On Wed, Oct 05, 2005 at 03:13:12PM +0530, Ninad Kalamkar wrote:
> i have a problem in triggers for that bellow is my table structure
>
> survey table
> <pgsql-php [at] postgresql.org>survey_id
>
> questions table
> question_id
> survey_id
>
> answer_options table
> answer_option_id
> question_id
>
>
> now the problem is
> i want to write a trigger after insert on survey table data should be
> inserted in questions and answer options table
> i get survey_id by new.survey_id but in same function i am not getting
> question_id to insert in answer option for newly inserted questions as the
> trigger is on insert of survey table
> i don't want to use cascaded triggers because it is creating some more
> problems
> please guide me in this regards

--
Jim C. Nasby, Sr. Engineering Consultant jnasby [at] pervasive.com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
jnasby [ So, 09 Oktober 2005 20:07 ] [ ID #1003056 ]
Datenbanken » gmane.comp.db.postgresql.php » Triggers problem

Vorheriges Thema: Set Privileges on All Tables (or Sequences) at Once
Nächstes Thema: pg_dump