On Fri, Jan 17, 2025 at 7:03 AM Rafia Sabih <rafia.pghack...@gmail.com> wrote:
> Indeed you are right.
> Firstly, accept my apologies for not mentioning you in credits for this work. 
> Thanks a lot for your efforts, discussions with you were helpful in shaping 
> this patch and bringing it to this level.
>
> Next, yes the last version was using tuplestore for queries within the same 
> transaction after the second query. To overcome this, I came across this 
> method to identify if there is any other simultaneous query running with the 
> current query; now there is an int variable num_queries which is incremented 
> at every call of postgresBeginForeignScan and decremented at every call of 
> postgresEndForeignScan. This way, if there are simultaneous queries running 
> we get the value of num_queries greater than 1. Now, we check the value of 
> num_queries and use tuplestore only when num_queries is greater than 1. So, 
> basically the understanding here is that if postgresBeginForeignScan is 
> called and before the call of postgresEndForeignScan if another call to 
> postgresBeginForeignScan is made, then these are simultaneous queries.

This wouldn't be true in case of error, I believe.

-- 
Robert Haas
EDB: http://www.enterprisedb.com


Reply via email to