Re: Failed Assert while pgstat_unlink_relation

From: Andres Freund <andres(at)anarazel(dot)de>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: vignesh21(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Failed Assert while pgstat_unlink_relation
Date: 2022-12-05 17:41:19
Message-ID: 20221205174119.mtz52xkrbhpo7xqi@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2022-12-05 17:41:49 Re: Collation version tracking for macOS
Previous Message Jonathan Lemig 2022-12-05 17:39:01 Request to modify view_table_usage to include materialized views