Re: pg_upgrade does not upgrade pg_stat_statements properly

From: Dave Cramer <davecramer(at)postgres(dot)rocks>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: Jan Wieck <jan(at)wi3ck(dot)info>, Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_upgrade does not upgrade pg_stat_statements properly
Date: 2021-07-30 10:03:50
Message-ID: CADK3HHJ4BmJqB+BLHa-UL464q0_dLxkTA6sB51JAp6DOMpfufw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, 29 Jul 2021 at 22:03, Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:

> On Thu, Jul 29, 2021 at 02:14:56PM -0400, Jan Wieck wrote:
> >
> > I presume that pg_upgrade on a database with that extension installed
> would
> > silently succeed and have the pg_catalog as well as public (or wherever)
> > version of that function present.
>
> I'll have to run a pg_upgrade with it to be 100% sure, but given that this
> is a
> plpgsql function and since the created function is part of the extension
> dependencies (and looking at pg_dump source code for binary-upgrade mode),
> I'm
> almost certain that the upgraded cluster would have the pg96- version of
> the
> function even if upgrading to pg9.6+.
>
> Note that in that case the extension would appear to work normally, but the
> only way to simulate missing_ok = true is to add a BEGIN/EXCEPTION block.
>
> Since this wrapper function is extensively used, it seems quite possible to
> lead to overflowing the snapshot subxip array, as the extension basically
> runs
> every x minutes many functions in a single trannsaction to retrieve many
> performance metrics. This can ruin the performance.
>
> This was an acceptable trade off for people still using pg96- in 2021, but
> would be silly to have on more recent versions.
>
> Unfortunately I don't see any easy way to avoid that, as there isn't any
> guarantee that a new version will be available after the upgrade. AFAICT
> the
> only way to ensure that the correct version of the function is present
> from an
> extension point of view would be to add a dedicated function to overwrite
> any
> object that depends on the servers version and document the need to call
> that
> after a pg_upgrade.
>

What would happen if subsequent to the upgrade "ALTER EXTENSION UPGRADE"
was executed ?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Nancarrow 2021-07-30 10:30:30 Re: Segment fault when excuting SPI function On PG with commit 41c6a5be
Previous Message Prabhat Sahu 2021-07-30 09:37:37 Re: [Patch] ALTER SYSTEM READ ONLY