1
CREATE TABLE order (
id SERIAL PRIMARY KEY NOT NULL,
total_price DECIMAL(12, 2),
date TIMESTAMP WITH TIME ZONE DEFAULT now(),
product_amount INT
);
而另一台订单历史
CREATE TABLE order_history (
id SERIAL PRIMARY KEY NOT NULL,
order_id INT,
total_price DECIMAL(12, 2),
date TIMESTAMP WITH TIME ZONE DEFAULT now(),
product_amount INT
);
我需要ORDER
表的触发器功能,可以对事件触发,当我中插入一些数据ORDER
表或更新数据。此外,此过程必须将数据保存到表ORDER_HISTORY
中。
以下是此一个通用的解决方案:https://开头的wiki。 postgresql.org/wiki/Aud it_trigger_91plus – 2014-09-25 21:11:16