Re: [SQL] Problem with function and trigger...

2005-09-28 Thread Ian Meyer
On 9/28/05, Tom Lane <[EMAIL PROTECTED]> wrote: > Ian Meyer <[EMAIL PROTECTED]> writes: > > IF TG_OP = 'DELETE' AND OLD.deleted = FALSE THEN > > > ERROR: record "old" is not assigned yet > > DETAIL: The tuple structure of a not-yet-

[SQL] Problem with function and trigger...

2005-09-28 Thread Ian Meyer
I have a function declared as such: CREATE OR REPLACE FUNCTION thread_sync() RETURNS trigger AS $$ BEGIN IF TG_OP = 'DELETE' AND OLD.deleted = FALSE THEN UPDATE member SET total_threads=total_threads-1 WHERE id=OLD.member_id; RETURN OLD; ELSEIF TG_OP = 'INSERT' THEN UPDATE member S