pgxn / pgxn-manager

Interface for managing extensions on PGXN
http://pgxn.org
47 stars 18 forks source link

PGXN doesn't support multiple major release versions #52

Closed GeoffMontee closed 3 years ago

GeoffMontee commented 8 years ago

Hi,

I uploaded tds_fdw-2.0.0-alpha1 to PGXN a while back. tds_fdw's 2.0 release branch isn't entirely stable yet, so I also just released tds_fdw-1.0.8. However, PGXN won't let me upload this package because the version number is less than the last version that I uploaded:

Distribution “tds_fdw 1.0.8” version less than in previous release “tds_fdw 2.0.0-alpha1”

I don't think it's too unusual to release a patch release of an older major release version while the new major release version is still alpha or beta. Is this a use case that is not supported by PGXN?

theory commented 8 years ago

Hrm. This was added in response to #32, following the precedent set by CPAN. I agree it's not unusual to release patches of older versions, but I'm somewhat reluctant to make the algorithm for determining what's okay to have a lower version and what's not. I mean I guess it could be:

Is that too complicated?

GeoffMontee commented 8 years ago

Hi @theory,

Thanks for the response. That suggested algorithm sounds pretty reasonable to me from a user's perspective, if you're willing to implement that.

theory commented 8 years ago

Added it to the v0.20 milestone. Dunno when I'll have time to hack on PGXN again, though. Anyone else want to contribute? Most likely would require updating the functions in sql/14-dist_processing.sql.

GeoffMontee commented 8 years ago

I might be able to find time to do this. I have some questions first though.

Adding this sort of version comparison logic requires that we are able to parse out each component of the semver in pgxn's PL/pgSQL code. We could probably do that with regexp_matches or something inside PL/pgSQL, but I'm not so sure that's the best approach.

Instead of doing something like that, how do you feel about adding adding functions like get_semver_major, get_semver_minor, get_semver_patch to https://github.com/theory/pg-semver/? If I'm understanding the pg-semver code correctly, functions like this should be fairly easy to add.

We could just add lines like the following to src/semver.c:

Datum
get_semver_major(PG_FUNCTION_ARGS);

PG_FUNCTION_INFO_V1(get_semver_major);
Datum
get_semver_major(PG_FUNCTION_ARGS)
{
    semver* sv = PG_GETARG_SEMVER_P(0);
    int major = sv->numbers[0];
    PG_RETURN_INT32(major);
}

And then something like the following could be added to sql/semver.sql:

CREATE OR REPLACE FUNCTION get_semver_major(semver)
    RETURNS int4
    AS 'semver'
    LANGUAGE C STRICT IMMUTABLE;

If pg-semver had functions like that, it might simplify the changes that would need to go into pgxn's sql/14-dist_processing.sql file to implement this new feature. How does that sound to you?

theory commented 8 years ago

+1 Sounds good to me!

GeoffMontee commented 8 years ago

I just created a pull request for pg-semver that adds these new functions: https://github.com/theory/pg-semver/pull/27

theory commented 7 years ago

Okay, I've released semver v0.16.0 with your changes, thanks! You'll want to document the updated requirement in the README.

theory commented 3 years ago

Started a fix in d2bd3bf using your changes to sever, @GeoffMontee, thanks!