标签:trigger font plpgsql 触发器 hit isp instead webkit int
1 建立大表。
2 创建分区继承
3 定义Rule或者Trigger?
1 建立大表
CREATE TABLE student (student_id bigserial, name varchar(32), score smallint)
2 创建分区继承
CREATE OR REPLACE RULE insert_student_qualified
AS ON INSERT TO student
WHERE score >= 60
DO INSTEAD
INSERT INTO student_qualified VALUES(NEW.*);
CREATE OR REPLACE RULE insert_student_nqualified
AS ON INSERT TO student
WHERE score < 60
DO INSTEAD
INSERT INTO student_nqualified VALUES(NEW.*);
(2)创建方法及触发器
REATE OR REPLACE FUNCTION student_insert_trigger()
RETURNS TRIGGER AS
$$
$$
LANGUAGE plpgsql ;
//创建触发器
REATE TRIGGER insert_student
BEFORE INSERT ON student
FOR EACH row
EXECUTE PROCEDURE student_insert_trigger() ;
标签:trigger font plpgsql 触发器 hit isp instead webkit int
原文地址:http://www.cnblogs.com/jinyuttt/p/6492599.html