Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd
Date
Msg-id CAKU4AWqgn=pYjczw=bqd9xVprrw3negPCeyR0XVWqQ66DvokSQ@mail.gmail.com
Whole thread Raw
In response to Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd  (Andy Fan <zhihui.fan1213@gmail.com>)
Responses Re: Can I assume relation would not be invalid during from ExecutorRun to ExecutorEnd
List pgsql-hackers

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 the first time I write data into
the relation, until the statement is completed or "aborted and RelationClose is called in ResourceOwnerRelease",
the relcache reset should never happen. 

Since there are many places the write table access methods can be called like COPY,  CAST,  REFRESH MATVIEW,
VACUUM and ModifyNode,  and it is possible that we can get error in each place,  so I think RelationClose
should be a great places for exceptional case(at the same time, we should remember to destroy properly for non
exceptional case). 

This might be not very professional since I bind some executor related data into a relcache related struct.
But it should be workable in my modified user case.  The most professional method I can think out is adding
another resource type in ResourceOwner and let ResourceOwnerRelease to handle the exceptional cases.

--
Best Regards
Andy Fan

pgsql-hackers by date:

Previous
From: Ram Pratap Maurya
Date:
Subject: PostgreSQL server: authentication method 10 not supported
Next
From: Amit Kapila
Date:
Subject: Re: row filtering for logical replication