Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit893c66d

Browse files
committed
Simplify trigger example, per Mark Kirkwood.
1 parent2c1abfd commit893c66d

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)

[8]ページ先頭

©2009-2025 Movatter.jp