Re: SPI and CommandCounterIncrement, redux - Mailing list pgsql-hackers

From Tom Lane
Subject Re: SPI and CommandCounterIncrement, redux
Date
Msg-id 13400.1006353563@sss.pgh.pa.us
Whole thread Raw
In response to Re: SPI and CommandCounterIncrement, redux  ("Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at>)
List pgsql-hackers
"Zeugswetter Andreas SB SD" <ZeugswetterA@spardat.at> writes:
>> Note the failure to display "Name :: name4".  The problem is that
>> no CommandCounterIncrement happens between the second INSERT and
>> the FOR ... SELECT, so the inserted row is considered not yet visible.

> I wonder why the insert does not do the CommandCounterIncrement,
> since it is a statement that did modification and all subsequent 
> statements should see the effect ?
> In other places this is the usual practice (CommandCounterIncrement
> after modification), no ?

SPI's habit is to do CommandCounterIncrement *before* it starts a query,
rather than after.  I think this makes sense, since otherwise we'd have
to do a CommandCounterIncrement at the start of every function call,
whether the function contained any subqueries or not.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Regression tests need updating...
Next
From: Tom Lane
Date:
Subject: Re: internals.ps