pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Triggers problem
2+ messages / 2 participants
[nested] [flat]

* Triggers problem
@ 2005-10-05 09:43  Ninad Kalamkar <ninadk@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Ninad Kalamkar @ 2005-10-05 09:43 UTC (permalink / raw)
  To: pgsql-php

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: Triggers problem
@ 2005-10-09 18:07  Jim C. Nasby <jnasby@pervasive.com>
  parent: Ninad Kalamkar <ninadk@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Jim C. Nasby @ 2005-10-09 18:07 UTC (permalink / raw)
  To: Ninad Kalamkar <ninadk@gmail.com>; +Cc: pgsql-php

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-10-09 18:07 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-10-05 09:43 Triggers problem Ninad Kalamkar <ninadk@gmail.com>
2005-10-09 18:07 ` Jim C. Nasby <jnasby@pervasive.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox