Re: Failed Assert in pgstat_assoc_relation

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
Cc: vignesh C <vignesh21@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-11-28T21:33:20Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Something like the attached. Still needs a bit of polish, e.g. adding the test
> case from above.

> I'm a bit uncomfortable adding a function call below
> 		 * Perform swapping of the relcache entry contents.  Within this
> 		 * process the old entry is momentarily invalid, so there *must* be no
> 		 * possibility of CHECK_FOR_INTERRUPTS within this sequence. Do it in
> 		 * all-in-line code for safety.

Ugh.  I don't know what pgstat_unlink_relation does, but assuming
that it can never throw an error seems like a pretty bad idea,
especially when you aren't adding that to its API spec (contrast
the comments for MemoryContextSetParent).

Can't that part be done outside the critical section?

			regards, tom lane



Commits

  1. Prevent pgstats from getting confused when relkind of a relation changes

  2. Remove logic for converting a table to a view.