Tzahi Fadida <tzahi.ml@gmail.com> writes:
> I am not sure about the definition of a context of a single SQL command.
Well, AFAICS selecting a disjunction ought to qualify as a single SQL
command using a single snapshot. It's not that different from a JOIN
or UNION operation, no?
> Inside C-language FullDisjunctions() function i repeatedly call, using
> SPI:
> SELECT * FROM Relation1;
> SELECT * FROM Relation2;
> SELECT * FROM Relation1 WHERE...;
> SELECT * FROM Relation3;
> ....
You would need to force all these operations to be done with the same
snapshot; should be possible with SPI_execute_snapshot. But really the
above sounds like a toy prototype implementation to me. Why aren't you
building this as executor plan-tree machinery?
> p.s.: In a different version of the function i create a temporary
> relation and insert tuples in it, but it is exclusively used and
> destroyed by the specific instance of that function.
Why? You could use a tuplestore for transient data.
regards, tom lane