From: Kris Kiger <kris@musicrebellion.com>
To: Pgsql-Admin (E-mail) <pgsql-admin@postgresql.org>
Subject: Re: Functions and transactions
Date: Thu, 10 Mar 2005 09:27:52 -0500
Message-ID: <42305968.10100@musicrebellion.com> (raw)
In-Reply-To: <7701.1110407641@sss.pgh.pa.us>
References: <421CF15C.6010306@turtle-entertainment.de>
<421CF1CE.3000800@turtle-entertainment.de>
<422F6203.1090800@musicrebellion.com>
<7701.1110407641@sss.pgh.pa.us>
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@musicrebellion.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
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: kris@musicrebellion.com
Subject: Re: Functions and transactions
In-Reply-To: <42305968.10100@musicrebellion.com>
References: <421CF15C.6010306@turtle-entertainment.de> <421CF1CE.3000800@turtle-entertainment.de> <422F6203.1090800@musicrebellion.com> <7701.1110407641@sss.pgh.pa.us> <42305968.10100@musicrebellion.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox