Nested SPI_exec's

From: Jason Godden <jasongodden(at)optushome(dot)com(dot)au>
To: pgsql-general(at)postgresql(dot)org
Subject: Nested SPI_exec's
Date: 2003-10-06 08:30:34
Message-ID: 200310061830.34357.jasongodden@optushome.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi All,

I'm in the process of moving a rather complicated plpgsql stored procedure to
a C module and I'm curious about how to implement the for each row syntax in
C. My understanding is that if you perform an SPI_exec whilst looping
through the results of another exec the allocated SPITupleTable will be
automatically unallocated. Is this correct or am I way off here and it's
actually safe to iterate through the tuples in an SPITupleTable and perform
additional SPI_exec's? Thinking about this now it probably is but I thought
it better to ask.

The other query I have relates to the transaction 'safe-ness' of a C module.
If I initiate all of this within a transaction (from outside the C module),
is everything within the SPI module automagically encapsulated with the
transaction or do I have to manage the transaction from within the SPI
module?

Rgds,

Jason

Responses

Browse pgsql-general by date

  From Date Subject
Next Message CSN 2003-10-06 09:10:24 orphaned psql's
Previous Message Pavel Stehule 2003-10-06 08:13:59 Re: Tree traversing. Like Oracle START WITH...CONNECT BY