Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-12-02 Thread Robert Haas
On Wed, Dec 1, 2021 at 10:58 PM Andy Fan wrote: > Thanks! I clearly understand what's wrong in my previous knowledge. Cool, glad it helped. -- Robert Haas EDB: http://www.enterprisedb.com

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-12-01 Thread Andy Fan
> If the relation is open, > the relcache entry can't be destroyed altogether, but it can be > rebuilt: see RelationClearRelation(). Thanks! This is a new amazing knowledge for me! > They are in fact stable in a certain sense - if we have the relation open we hold a reference count on it, and

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-12-01 Thread Robert Haas
On Tue, Nov 30, 2021 at 7:50 PM Andy Fan wrote: > I think you misunderstand me, I argued with the answer because after I got > the > answer and I rethink my problem, I found my question description is not > accurate > enough, so I improved the question and willing discussion again. My > excep

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-30 Thread Andy Fan
On Wed, Dec 1, 2021 at 3:33 AM Robert Haas wrote: > On Tue, Nov 30, 2021 at 4:47 AM Andy Fan wrote: > >> my exception should be that the relcache should not be invalidated > _after the first relation open_ > >> in the executor (not the beginning of executorRun)。 > > > > s/exception/expectation.

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-30 Thread Robert Haas
On Tue, Nov 30, 2021 at 4:47 AM Andy Fan wrote: >> my exception should be that the relcache should not be invalidated _after >> the first relation open_ >> in the executor (not the beginning of executorRun)。 > > s/exception/expectation. > > To be more accurate, my expectation is for a single sql

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-30 Thread Andy Fan
Thanks for everyone's insight so far! my exception should be that the relcache should not be invalidated _after > the first relation open_ > in the executor (not the beginning of executorRun)。 > > s/exception/expectation. To be more accurate, my expectation is for a single sql statement, after

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Dilip Kumar
On Tue, Nov 30, 2021 at 12:12 PM Andy Fan wrote: >> >> >> You will see there are many pointers also in >> RelationData but we ensure before we access them they are initialized, > > > The initialized values are not much helpful in the cases I provided here. > > What do you think about this questio

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
> > > You will see there are many pointers also in > RelationData but we ensure before we access them they are initialized, > The initialized values are not much helpful in the cases I provided here. What do you think about this question? 2. _If_ the relation can be reset after we open it durin

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Dilip Kumar
On Tue, Nov 30, 2021 at 6:44 AM Andy Fan wrote: >> >> >>> >>> Why do you think this ought to be in the relcache, and not in the >>> executor's rangetable-associated data structures? > > > I re-think about this, I guess I didn't mention something clear enough. > That's true that I bound my bala s

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
> > > >> Why do you think this ought to be in the relcache, and not in the >> executor's rangetable-associated data structures? >> > I re-think about this, I guess I didn't mention something clear enough. That's true that I bound my bala struct to Relation struct, and the memory relation used is

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
On Mon, Nov 29, 2021 at 10:56 PM Robert Haas wrote: > On Mon, Nov 29, 2021 at 2:10 AM Andy Fan wrote: > > 1. During the ExecutorRun & ExecutorEnd, the relcache will never by > invalidated, if not > > the old relation->balabala will be lost. I assume this is correct since > I didn't see any pl

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Andy Fan
On Mon, Nov 29, 2021 at 10:33 PM Tom Lane wrote: > Andy Fan writes: > > During my recent work, I need some new stuff attached to Relation. > Rather > > than adding > > some new data structures, I added it to Relation directly. Like > > relation->balabala. Then > > I initialize it during Exec

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Robert Haas
On Mon, Nov 29, 2021 at 2:10 AM Andy Fan wrote: > 1. During the ExecutorRun & ExecutorEnd, the relcache will never by > invalidated, if not > the old relation->balabala will be lost. I assume this is correct since I > didn't see any places > where we handle such changes in Executor code. It'

Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-29 Thread Tom Lane
Andy Fan writes: > During my recent work, I need some new stuff attached to Relation. Rather > than adding > some new data structures, I added it to Relation directly. Like > relation->balabala. Then > I initialize it during ExecutorRun, like table_tuple_insert.. and > destroy it at Executo

Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd

2021-11-28 Thread Andy Fan
Hi, During my recent work, I need some new stuff attached to Relation. Rather than adding some new data structures, I added it to Relation directly. Like relation->balabala. Then I initialize it during ExecutorRun, like table_tuple_insert.. and destroy it at ExecutorEnd. The above solution