postgresql数据库3种程序(rule,trigger ,FUNCTION )

1.

CREATE [ OR REPLACE ] RULE name AS ON event

TO table_name [ WHERE condition ]

DO [ ALSO | INSTEAD ] { NOTHING | command | ( command ; command ... ) }

2.

CREATE  TRIGGER trigger_name [BEFORE|AFTER|INSTEAD OF] event_name
ON table_name
[
-- Trigger logic goes here....
];

3.

CREATE [OR REPLACE] FUNCTION function_name (arguments)
RETURNS return_datatype AS $variable_name$
DECLARE
declaration;
[...]
BEGIN
< function_body >
[...]
RETURN { variable_name | value }
END; LANGUAGE plpgsql;
上一篇:试读《基于MVC的JavaScript Web富应用开发》— 不一样的JavaScript


下一篇:directly receive json data from javascript in mvc