Skip to content

Commit 893c66d

Browse files
committed
Simplify trigger example, per Mark Kirkwood.
1 parent 2c1abfd commit 893c66d

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

doc/src/sgml/plpgsql.sgml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.56 2005/01/14 01:16:22 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/plpgsql.sgml,v 1.57 2005/01/15 03:38:44 tgl Exp $
33
-->
44

55
<chapter id="plpgsql">
@@ -2787,17 +2787,12 @@ CREATE OR REPLACE FUNCTION maint_sales_summary_bytime() RETURNS TRIGGER AS $main
27872787
amount_sold,
27882788
units_sold,
27892789
amount_cost)
2790-
SELECT f.time_key,
2791-
sum(f.amount_sold),
2792-
sum(f.units_sold),
2793-
sum(f.amount_cost)
2794-
FROM sales_fact f
2795-
WHERE f.time_key = delta_time_key
2796-
GROUP BY f.time_key;
2797-
-- This query can potentially be very expensive if the trigger
2798-
-- is created on sales_fact without the time_key indexes.
2799-
-- Some care is needed to ensure that this situation does
2800-
-- *not* occur.
2790+
VALUES (
2791+
delta_time_key,
2792+
delta_amount_sold,
2793+
delta_units_sold,
2794+
delta_amount_cost
2795+
);
28012796
EXCEPTION
28022797
--
28032798
-- Catch race condition when two transactions are adding data

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy