From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | Postgres SQL language list <pgsql-sql(at)postgresql(dot)org> |
Subject: | Problem with array subscripts in plpgsql trigger function |
Date: | 2006-07-05 16:52:10 |
Message-ID: | 44ABEE3A.1030609@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Ok, I have a trigger set up on the following (stripped down) table:
CREATE TABLE members (
member_id bigint,
member_status_id smallint,
member_is_deleted boolean
);
Here's a shortened version of the trigger function:
CREATE OR REPLACE FUNCTION update_member() RETURNS TRIGGER AS $um$
DECLARE
status_deltas integer[];
BEGIN
IF(NEW.member_status_id != OLD.member_status_id AND
NEW.member_is_deleted IS NOT TRUE) THEN
status_deltas[NEW.member_status_id] := 1;
status_deltas[OLD.member_status_id] := -1;
END IF;
/*and after a couple more such conditional assignments I use the
values in status_deltas to update another table holding status totals here*/
END;
$um$ LANGUAGE plpgsql;
on the two lines that access set array values I'm getting the following
error:
ERROR: invalid array subscripts
What gives?
--
erik jones <erik(at)myemma(dot)com>
software development
emma(r)
From | Date | Subject | |
---|---|---|---|
Next Message | Aaron Bono | 2006-07-05 17:36:16 | Re: Problem with array subscripts in plpgsql trigger function |
Previous Message | A. Kretschmer | 2006-07-05 15:34:15 | Re: Foreign Key: what value? |