Verify your knowledge
- What is the
NEWrecord?The
NEWrecord is the record that is going to be processed before anINSERTstatement or anUPDATEstatement, for example:insert into mytable(id,city_name) values (1,'New York')NEW.id = 1 NEW.city_name = 'New York'See the section Exploring rules in PostgreSQL for more details.
- Can we execute an
INSERTon two tables in a single transaction using rules?Yes, we can; we can make it using the
ALSOclause. See the section Exploring rules in PostgreSQL for more details.
- Can we make all the things we do with rules using triggers?
Yes, we can; by using triggers, we can make all the things we do with rules and more. See the section Managing triggers in PostgreSQL for more details.
- Can we know if a trigger has been fired from an
INSERTevent, from an updateEVENT, or from aDELETEevent?Yes, we can, using the
TG_OPvariable...