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
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings