Nested SPI_exec's - Mailing list pgsql-general

From Jason Godden
Subject Nested SPI_exec's
Date
Msg-id 200310061830.34357.jasongodden@optushome.com.au
Whole thread Raw
Responses Re: Nested SPI_exec's
List 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

pgsql-general by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Tree traversing. Like Oracle START WITH...CONNECT BY
Next
From: CSN
Date:
Subject: orphaned psql's