Hi, On 2022-12-05 15:20:55 +0900, Kyotaro Horiguchi wrote: > The in-xact created relation t1 happened to be scanned during the > CREATE RULE and a stats entry is attached. So the stats entry loses t1 > at roll-back, then crashes. Thus, if I understand it correctly, it > seems to me that just unlinking the stats from t1 (when relkind is > changed) works. > > But the fix doesn't change the behavior in relkind-not-changing > cases. If an in-xact-created table gets a stats entry then the > relcache entry for t1 is refreshed to a table relation again then the > transaction rolls back, crash will happen for the same reason. I'm not > sure if there is such a case actually.
We unlink the stats in that case already. see RelationDestroyRelation(). > When I tried to check that behavior further, I found that that > CREATE ROLE is no longer allowed.. I assume you mean RULE, not ROLE? It should still work in 15. Greetings, Andres Freund