Re: Can we let extensions change their dumped catalog schemas? - Mailing list pgsql-hackers

From Jacob Champion
Subject Re: Can we let extensions change their dumped catalog schemas?
Date
Msg-id CAAWbhmgwCWR1GNQaYOPP=uCX2E_ZU9oPHaJhBvyUksnfgdF4bg@mail.gmail.com
Whole thread Raw
In response to Re: Can we let extensions change their dumped catalog schemas?  (Jacob Champion <jchampion@timescale.com>)
Responses Re: Can we let extensions change their dumped catalog schemas?  (Jacob Champion <jchampion@timescale.com>)
List pgsql-hackers
On Tue, Jan 17, 2023 at 3:18 PM Jacob Champion <jchampion@timescale.com> wrote:
> As a concrete example, Timescale's extension control file could look
> like this:
>
>     default_version = '2.x.y'
>     module_pathname = '$libdir/timescaledb-2.x.y'
>     ...
>     dump_version = true
>
> which would then cause pg_dump to issue a VERSION for its CREATE
> EXTENSION line. Other extensions would remain with the default
> (dump_version = false), so they'd be dumped without an explicit VERSION.

Even more concretely, here's a draft patch. There's no nuance --
setting dump_version affects all past versions of the extension, and
it can't be turned off at restore time. So extensions opting in would
have to be written to be side-by-side installable. (Ours is, in its
own way, but the PGDG installers don't allow it -- which maybe
highlights a weakness in this approach.) I'm still not sure if this
addresses Tom's concerns, or just adds new ones.

We could maybe give the user more control by overriding the default
version for an extension in a different TOC entry, and then add
options to ignore or include those version numbers during restore.
That doesn't address the side-by-side problem directly but gives an
escape hatch.

Earlier I wrote:

> I'm curious about your
> opinion on option 3, since it would naively seem to make pg_dump do
> _less_ work for a given extension.

This was definitely naive :D We can't just make use of the
binary-upgrade machinery to dump extension internals, because it pins
OIDs. So that might still be a valid approach, but it's not "less
work."

Thanks,
--Jacob

Attachment

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Reduce timing overhead of EXPLAIN ANALYZE using rdtsc?
Next
From: Andres Freund
Date:
Subject: Re: How to solve "too many Lwlocks taken"?