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