From: Tom Lane Date: Sat, 15 Jan 2005 03:38:44 +0000 (+0000) Subject: Simplify trigger example, per Mark Kirkwood. X-Git-Tag: REL8_0_0~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=893c66de69a02d8e9ee83fb0fcdb284d01105e1d;p=thirdparty%2Fpostgresql.git Simplify trigger example, per Mark Kirkwood. --- diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml index 3842ee5ef7c..3a283bce5e4 100644 --- a/doc/src/sgml/plpgsql.sgml +++ b/doc/src/sgml/plpgsql.sgml @@ -1,5 +1,5 @@ @@ -2787,17 +2787,12 @@ CREATE OR REPLACE FUNCTION maint_sales_summary_bytime() RETURNS TRIGGER AS $main amount_sold, units_sold, amount_cost) - SELECT f.time_key, - sum(f.amount_sold), - sum(f.units_sold), - sum(f.amount_cost) - FROM sales_fact f - WHERE f.time_key = delta_time_key - GROUP BY f.time_key; - -- This query can potentially be very expensive if the trigger - -- is created on sales_fact without the time_key indexes. - -- Some care is needed to ensure that this situation does - -- *not* occur. + VALUES ( + delta_time_key, + delta_amount_sold, + delta_units_sold, + delta_amount_cost + ); EXCEPTION -- -- Catch race condition when two transactions are adding data