Trigger to update records out of memory - Mailing list pgsql-general

From Robert Fitzpatrick
Subject Trigger to update records out of memory
Date
Msg-id 1087579054.2735.12.camel@columbus
Whole thread Raw
Responses Re: Trigger to update records out of memory  (Robert Fitzpatrick <robert@webtent.com>)
List pgsql-general
On 7.4.2 I have a trigger that I want to update any existing boolean
values to false if a new one in that group is declare true by inserting
a new record or updating an existing record:

ohc=# CREATE OR REPLACE FUNCTION "public"."clear_common_groups" ()
RETURNS trigger AS'
ohc'# BEGIN
ohc'#   IF NEW.common_area = ''t'' THEN
ohc'#     UPDATE tblhudunits SET common_area = ''f'' WHERE
hud_building_id = NEW.hud_building_id;
ohc'#   END IF;
ohc'#   IF NEW.exterior_area = ''t'' THEN
ohc'#     UPDATE tblhudunits SET exterior_area = ''f'' WHERE
hud_building_id = NEW.hud_building_id;
ohc'#   END IF;
ohc'#   RETURN NULL;
ohc'# END;
ohc'# 'LANGUAGE 'plpgsql' IMMUTABLE CALLED ON NULL INPUT SECURITY
INVOKER;
CREATE FUNCTION
ohc=# CREATE TRIGGER "new_common_area" BEFORE INSERT OR UPDATE
ohc-# ON "public"."tblhudunits" FOR EACH ROW
ohc-# EXECUTE PROCEDURE "public"."clear_common_groups"();
CREATE TRIGGER
ohc=# update tblhudunits set common_area = 't' where sort_order = 2;
ERROR:  out of memory
DETAIL:  Failed on request of size 1048576.

Can someone point out what I am obviously doing wrong?

--
Robert


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Variadic functions in plpgsql?
Next
From: Duane Lee - EGOVX
Date:
Subject: Re: INSERT ON DUPLICATE KEY UPDATE