Trigger to update records out of memory

From: Robert Fitzpatrick <robert(at)webtent(dot)com>
To: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Trigger to update records out of memory
Date: 2004-06-18 17:17:34
Message-ID: 1087579054.2735.12.camel@columbus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Duane Lee - EGOVX 2004-06-18 17:19:40 Re: INSERT ON DUPLICATE KEY UPDATE
Previous Message Thomas Hallgren 2004-06-18 17:11:03 Re: [OT] Dilemma about OS <-> Postgres interaction