From c0acb474ac3ed2a4643051e9930372cf6ba0e7e3 Mon Sep 17 00:00:00 2001 From: dullbananas Date: Sat, 23 Dec 2023 09:28:12 -0700 Subject: [PATCH] Update replaceable_schema.sql --- replaceable_schema.sql | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/replaceable_schema.sql b/replaceable_schema.sql index 11dc6679a..8bd2c0dbb 100644 --- a/replaceable_schema.sql +++ b/replaceable_schema.sql @@ -18,7 +18,7 @@ DROP SCHEMA IF EXISTS r CASCADE; CREATE SCHEMA r; --- These triggers resolve an item's reports when the item is removed. +-- These triggers resolve an item's reports when the item is marked as removed. CREATE FUNCTION resolve_reports_when_post_removed () RETURNS trigger LANGUAGE plpgsql @@ -157,11 +157,10 @@ BEGIN 1 FROM site_aggregates) THEN - INSERT INTO site_aggregates (site_id) - SELECT - id, - FROM - new_site; + INSERT INTO + site_aggregates (site_id) + VALUES + (NEW.id); RETURN NULL; END @@ -169,8 +168,7 @@ $$; CREATE TRIGGER aggregates AFTER INSERT ON site - REFERENCING NEW TABLE AS new_site - FOR EACH STATEMENT + FOR EACH ROW EXECUTE FUNCTION r.site_aggregates_from_site (); COMMIT;