On Wed, 2024-07-31 at 18:20 +0900, Yugo NAGATA wrote:
> I agree that it might not be important, but I think adding the flag
> would be
> also helpful for improving code-readability because it clarify the
> function
> is used in the two cases. I attached patch for this fix (patch 0003).
Committed with one minor modification: I moved the boolean flag to be
near the other booleans rather than at the end. Thank you.
> Sure. I fixed the patch to remove 'param' from both functions. (patch
> 0002)
Committed, thank you.
> I also add the small refactoring around ExecCreateTableAs(). (patch
> 0001)
>
> - Remove matview-related codes from intorel_startup.
> Materialized views are no longer handled in this function.
>
> - RefreshMatViewByOid is moved to just after create_ctas_nodata
> call to improve code readability.
>
I'm not sure the changes in intorel_startup() are correct. I tried
adding an Assert(into->viewQuery == NULL), and it fails because there's
another path I did not consider: "EXPLAIN ANALYZE CREATE MATERIALIZED
VIEW ...", which does not go through ExecCreateTableAs() but does go
through CreateIntoRelDestReceiver().
See:
https://postgr.es/m/20444c382e6cb5e21e93c94d679d0198b0dba4dd.camel@j-davis.com
Should we refactor a bit and try to make EXPLAIN use the same code
paths?
Regards,
Jeff Davis