On Tue, Jul 21, 2020 at 04:55:37PM -0400, Bruce Momjian wrote:
> I know Tom put a wink on that, but I actually do feel that the only
> clean way to do this is to give users a way to issue the query in a
> non-executing way that will report if a rewrite is going to happen.
Yeah, when doing a schema upgrade for an application, that's the usual
performance pin-point and people used to other things than Postgres
write their queries without being aware of that. We have something
able to track that with the event trigger table_rewrite, but there is
no easy option to store the event and bypass its execution. I think
that using a plpgsql function wrapping an ALTER TABLE query with an
exception block for an error generated by an event trigger if seeing
table_rewrite allows to do that, though.
--
Michael