Re: cache problem (v2) - Mailing list pgsql-admin

From Andrew Sullivan
Subject Re: cache problem (v2)
Date
Msg-id 20070717162306.GH21688@phlogiston.dyndns.org
Whole thread Raw
In response to Re: cache problem (v2)  (De Leeuw Guy <G.De_Leeuw@eurofer.be>)
Responses Re: cache problem (v2)
List pgsql-admin
On Tue, Jul 17, 2007 at 05:49:15PM +0200, De Leeuw Guy wrote:

> > Your trigger function runs inside the transaction of the calling
> > statement, unless you have explicitly started a transaction.
> >
> Not possible from a trigger

Yes, sorry, I phrased that wrong.  Let me put it differently: your
trigger runs only inside the transaction of the calling statement,
unless that statement itself is inside a longer explicitly-called
transaction.  For example:

t1                        t2

BEGIN
UPDATE table_with_trigger
SELECT something             SELECT ...FROM trigger_effect
INSERT something else
COMMIT

In this case, t2 does _not_ see the effects of the trigger in t1,
because those effects are not visible until the COMMIT.  But

t1                        t2

UPDATE table_with_trigger
SELECT something            SELECT...FROM trigger_effect
INSERT something else

in this case, t2 _does_ see the effects, because the trigger's
effects are COMMITted implicitly after the UPDATE statement.

> Yes true, It's my first step with postgres but also with a relationnal
> database.
> But I'm sure that with COPY the data are not correctly updated and
> if I edit the file loaded by the COPY command and adapt it with each
> line with a command INSERT all work fine.

If I read that right, you admit that you are inexperienced with the
concepts and the software, and you are unable to show us all the
relevant code or send us a precise description of what you are
doing; but, you are convinced nevertheless that the problem is a bug
or deficiency in PostgreSQL that nobody else seems to be having, and
not a problem with your approach?  I suggest you think again.

A

--
Andrew Sullivan  | ajs@crankycanuck.ca
However important originality may be in some fields, restraint and
adherence to procedure emerge as the more significant virtues in a
great many others.   --Alain de Botton

pgsql-admin by date:

Previous
From: De Leeuw Guy
Date:
Subject: Re: cache problem (v2)
Next
From: "Umesh Shastry"
Date:
Subject: Re: plpgsql debugger