Skip site navigation (1) Skip section navigation (2)

Re: creating triggers: need help

From: Bartosz Dmytrak <bdmytrak(at)eranet(dot)pl>
To: Navdeep Singh <navdeeps(dot)iitd(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: creating triggers: need help
Date: 2012-02-23 21:26:33
Message-ID: CAD8_UcZHo62pBi_9jS9ba-XLYvHUUmORBuSLReQWsV44sYW_sg@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
Hi,
few more questions...

Should new rich person be removed from table "persons"?
Does "rich" table inherits from "persons", or it is separate table?

btw. which PostgreSQL version - that is important when answer for first
question is YES?

Regards,
Bartek


2012/2/23 Navdeep Singh <navdeeps(dot)iitd(at)gmail(dot)com>

> Hey!
>
> I need to fire the trigger only when the number of houses is updated!
> Also, I'm considering only increment scenarios.
>
> Thanks and regards,
> Navdeep
>
> On Thu, Feb 23, 2012 at 9:20 PM, Bartosz Dmytrak <bdmytrak(at)eranet(dot)pl>wrote:
>
>> Hi,
>> what about scenario when reach person lost his houses?
>> trigger should be fired only for new entries and/or updated?
>>
>> Regards,
>> Bartek
>>
>>
>>
>> 2012/2/23 Navdeep Singh <navdeeps(dot)iitd(at)gmail(dot)com>
>>
>>> Hey!
>>>
>>> I am a penultimate year student of computer science and engg. I am
>>> looking for a way to create a trigger in postgresql. I've found some
>>> abstract methods for this on web but could not implement it. The
>>> description of the trigger is as follows:
>>>    I have two tables, one named people and other named rich. The people
>>> table contains two columns: name, no. of houses. The rich table contains
>>> the same columns.  I need to create a trigger to insert the tuple of the
>>> people table into the rich table when the number of houses of the given
>>> person (name) reaches, lets say 10.
>>>
>>> Please help me with the sql commands to implement the aforementioned
>>> transaction.
>>>
>>> Thanks,
>>> Navdeep
>>> navdeeps(dot)iitd(at)gmail(dot)com
>>>
>>
>>
>

In response to

Responses

pgsql-novice by date

Next:From: Tom LaneDate: 2012-02-23 23:51:30
Subject: Re: A little help interpreting a query plan
Previous:From: Andy ChambersDate: 2012-02-23 21:17:17
Subject: A little help interpreting a query plan

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group