From: | Kris Kiger <kris(at)musicrebellion(dot)com> |
---|---|
To: | "Pgsql-Admin (E-mail)" <pgsql-admin(at)postgresql(dot)org> |
Subject: | Re: Functions and transactions |
Date: | 2005-03-10 14:27:52 |
Message-ID: | 42305968.10100@musicrebellion.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin pgsql-hackers pgsql-patches |
Hmm.. I was trying simplify my function to get the point across with
minimal confusion. If you don't think there is enough detail, let me
know what is lacking and I will add the appropriate detail. The
function is executed BEFORE insert on table1. Thanks again for the help all
Kris
Tom Lane wrote:
>Kris Kiger <kris(at)musicrebellion(dot)com> writes:
>
>
>>Here is my problem. I have a function that is triggered on insert. For
>>simplicity's sake, lets say the function looks like this:
>>
>>
>
>
>
>>CREATE OR REPLACE FUNCTION dostuff_on_insert() RETURNS TRIGGER AS '
>>DECLARE lockrows RECORD;
>>BEGIN
>> select into lockrows * from table1 where pkey_id = NEW.pkey_id for
>>update on table1;
>> update table1 set active = false where NEW.pkey_id = pkey_id and active;
>> NEW.active := true;
>>END;
>>'language 'plpgsql';
>>
>>
>
>This is awfully vague. What table is the trigger placed on? (If table1
>itself, seems like there are more efficient ways to do this.) What
>events is the trigger fired for, and is it BEFORE or AFTER?
>
> regards, tom lane
>
>---------------------------(end of broadcast)---------------------------
>TIP 7: don't forget to increase your free space map settings
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-03-10 14:56:46 | Re: Too frequent warnings for wraparound failure |
Previous Message | Milen A. Radev | 2005-03-10 09:19:03 | Too frequent warnings for wraparound failure |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Hallgren | 2005-03-10 14:34:53 | Re: Runtime accepting build discrepancies |
Previous Message | Laszlo Hornyak | 2005-03-10 12:28:12 | Re: Runtime accepting build discrepancies |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-03-10 15:42:12 | Re: Functions and transactions |
Previous Message | Neil Conway | 2005-03-10 13:13:37 | Re: fork() refactoring |