Re: trigger
| От | Stefan Balzter |
|---|---|
| Тема | Re: trigger |
| Дата | |
| Msg-id | 437DEDC4.6010401@SteBaSoft.de обсуждение исходный текст |
| Ответ на | trigger ("Aftab Alam" <aalam@tatashare.com>) |
| Список | pgsql-general |
Aftab Alam schrieb: > I want to create a trigger in PostgresSQL > > In trigger, Before inserting the record, if data is already in the > table, the trigger fire the mesaage that data is already there, and > after that trigger ckeck for next insert statement. You write a function that returns the type "trigger" and checks whether the data is already there (i.e. by SELECTing INTO a variable the number of records with your given values and checking if the variable is >0). If it is, let it shout out your NOTICE and RETURN NULL; if it's not, RETURN NEW; Afterwards, you create the actual trigger BEFORE INSERT ON your table FOR EACH ROW and let it execute your recently written function :-) Good luck, Stefan Balzter
В списке pgsql-general по дате отправления: