RE: [PATCH] Support % wildcard in extension upgrade filenames

From: "Regina Obe" <lr(at)pcorp(dot)us>
To: <strk(at)kbt(dot)io>, <pgsql-hackers(at)postgresql(dot)org>, "'Laurenz Albe'" <laurenz(dot)albe(at)cybertec(dot)at>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: RE: [PATCH] Support % wildcard in extension upgrade filenames
Date: 2022-10-31 05:55:05
Message-ID: 000001d8eced$539c5bf0$fad513d0$@pcorp.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Just to reiterate the main impetus for this patch is to save PostGIS from
shipping 100s of duplicate extension files for each release.

> And now with the actual patch attached ... (sorry)
>
> --strk;
>

Sandro, can you submit an updated version of this patch.
I was testing it out and looked good first time.

But I retried just now testing against master, and it fails with

commands/extension.o: In function `file_exists':
postgresql-git\src\backend\commands/extension.c:3430: undefined reference to
`AssertArg'

It seems 2 days ago AssertArg and AssertState were removed.

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=b1099eca8f38f
f5cfaf0901bb91cb6a22f909bc6

So your use of AssertArg needs to be replaced with Assert I guess.
I did that and was able to test again with a sample extension I made

Called:

wildtest

1) The wildcard patch in its current state only does anything if

wildcard_upgrades = true

is in the control file. If it's false or missing, then the behavior of
extension upgrades doesn't change.

2) It only understands % as a complete wildcard for a version number

So this is legal
wildtest--%--2.0.sql

This does nothing
wildtest--2%--2.0.sql

3) I confirmed that if you have a path such as

wildtest--2.0--2.2.sql
wildtest--%--2.2.sql

then the exact match trumps the wildcard. In the above case if I am on 2.0
and going to 2.2, the wildtest--2.0--2.2.sql script is used instead of the
wildtest--% one.

4) It is not possible to downgrade with the wildcard. For example I had
paths
wildtest--%--2.1.sql

and I was unable to go from a version 2.2 down to a version 2.1. I didn't
check why that was so, but probably a good thing.

If everyone is okay with this patch, we'll go ahead and add tests and
documentation to go with it.

Thanks,
Regina

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-10-31 06:05:44 Re: Adding doubly linked list type which stores the number of items in the list
Previous Message Masahiko Sawada 2022-10-31 05:46:53 Re: [PoC] Improve dead tuple storage for lazy vacuum