Name CREATEEVENTTRIGGER-- define a new event trigger Synopsis CREATEEVENTTRIGGERname ONevent [ WHEN filter_variable IN (filter_value [, ... ]) [ AND ... ] ] EXECUTEPROCEDURE function_name() Description CREATEEVENTTRIGGER creates a newevent trigger. Whenever the designated event occurs and the WHEN condition associated with the trigger, ifany, is satisfied, the triggerfunction will be executed. For a general introduction toeventtriggers, see Chapter 37. The user who creates an event triggerbecomes its owner.
pg91@redhat6 ~]$ psql -h 192.168.1.36 -p 1925 francs francs Password for user francs: psql (9.1.2, server 9.3beta1) WARNING: psql version 9.1, server version 9.3. Some psql features might not work. Type "help" for help. francs=> create table test_trigger(id serial primary key); CREATE TABLE francs=> CREATE or replace FUNCTION fun_ins_test_1(i int4) RETURNS INTEGER AS $$ francs$> BEGIN francs$> return $1::text; francs$> END; francs$> $$ LANGUAGE 'plpgsql'; CREATE FUNCTION
备注:这步在客户端(192.168.1.35) 上操作。
2.4.2 删除测试表和测试函数
1 2 3 4 5
francs=> drop table test_trigger; DROP TABLE francs=> dropfunction fun_ins_test_1(i int4); DROPFUNCTION