Home > Archive > PHP with PostgreSQL > October 2005 > Triggers problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Triggers problem
Ninad Kalamkar

2005-10-27, 8:14 am

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

survey table
<pgsql-php@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

2005-10-27, 8:14 am

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@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@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

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com