Revision history for PostgreSQL extension semver.

0.41.0  2025-12-18T01:55:38Z
      - Removed the `directory` and `MODULEDIR` directives that installed
        extension files in a subdirectory named "semver", as it's not
        necessary, and deprecated by PostgreSQL 18.
      - Removed the `$libdir/` prefix from the `module_pathname` directive,
        so that the module can be installed and found in any directory listed
        in `dynamic_library_path`.
      - Fixed some docs typos, thanks to @0xflotus (#75)
      - Supports PostgreSQL 9.2–18.
      - Converted the documentation from MultiMarkdown to Markdown, now that
        PGXN has upgraded its Markdown parser.

0.40.0  2024-07-20T20:35:03Z
      - Updated the installation configuration to install the SQL and
        documentation files into `semver` subdirectories.
      - Changed the tests to use `CREATE EXTENSION` instead of loading the
        SQL source file directory. The latter was required for Postgres 9.0
        and lower, which have not been supported since v0.20.0 back in 2018.
      - Fixed a bug that rejected pre-releases starting with a zero but
        eventually include a dash, e.g., `1.2.3-02-3`. Thanks to Dylan
        Bourque for the pull request (#70)!
      - ***** WARNING: This release breaks compatibility with previous versions! ******
        Fixed a bug in the scanning of pre-releases that start with a zero.
        It now properly scans the rest of the pre-release string. As a result,
        existing semvers with pre-releases that start with a zero may have been
        incorrectly interpreted as valid. Any versions returned by this query
        will need the leading 0 removed from the pre-release before upgrading:
        `SELECT version FROM pkg WHERE get_semver_prerelease(version) ~ '^0\[0-9]+($|\+)'`
        Discovered while debugging unexpected test failures in #70.

0.32.1  2023-08-01T23:20:31Z
      - Fixed compilation issue on Postgres 16.

0.32.0  2022-10-23T21:53:54Z
      - Add support for binary input (receive) and output (send) functions.
        Thanks to Anna Clemens for the pull request (#61)!

0.31.2  2021-09-28T02:03:35Z
      - Add an overflow check and properly compare the max size of INT32
        rather than INT. Thanks to Felix Lechner for the report and Tom Lane
        for the C lesson (#58).

0.31.1  2021-04-27T00:10:07Z
      - Updated the C code to pass the correct number of arguments to
        `hashint2()`. Thanks to Andrew Gierth for the spot.
      - Fixed an error in processing the prerelease where it could sometimes
        incorrectly report throw an error saying "prerelease numbers can't
        start with 0" for prereleases with no such leading zero.

0.31.0  2020-10-17T22:30:00Z
      - Added a workaround for an LLVM bitcode compile error. Thanks to
        @mark-s-a for the report (#40).
      - Removed `--load-language` from the options for running the tests,
        as it has not been needed since 9.1, we support 9.2 and higher,
        and it has been removed from Postgres 13.
      - Fixed an a collation error on Postgres 12 and higher. Thanks to
        Andrew for Marc Munro for the report and to Andrew Gierth for the
        fix (pgxn/pgxn-manager#67).
      - Prerelease parts are no longer compared compared case-insensitively,
        but in ASCII sort order, as required by the spec. This is a breaking
        change in the sense that `1.0.0-rc1` will now be considered greater than
        `1.0.0-RC1`, rather than equivalent, but they're both still valid. See
        https://github.com/semver/semver/issues/176 for the relevant
        discussion. Thanks to Andrew Gierth for the spot!

0.30.0  2020-05-16T19:28:36Z
      - ***** WARNING: This release breaks compatibility with previous versions! ******
        Previous versions of the semver extension incorrectly allowed some
        invalid prerelease and build metadata values. Details below, but *BEFORE
        YOU UPGRADE* we strongly recommend that you check for and repair any
        invalid semvers. You can find them using the official [SemVer regular
        expression](https://regex101.com/r/vkijKf/1/) like so:

        SELECT name, version FROM packages
         WHERE version::text !~ '^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$';

        If no rows are returned, you should be good to go. If there are results,
        here are Examples of invalid semantic versions and how they should be
        repaired.

            1.0.0-02799   ->   1.0.0-2799
            1.0.0-0.02    ->   1.0.0-0.2
            1.0.0-.20     ->   1.0.0-0.20
            1.0.0+0+20    ->   1.0.0+0-20  or  1.0.0+0.20
            1.0.0+.af     ->   1.0.0+0.af  or  1.0.0+af

        And now, back to your regularly-scheduled changes.

      - Fixed an error formatting prerelease parts for semvers longer than
        32 bytes. Thanks to @Nemo157 for the report and suggested fix (#48).
      - Removed code that converted dashes to dots in prerelease parts. It
        had been doing so on the assumption that dashes were invalid in SemVer
        1.0 and 2.0 prerelease parts, but that does not turn out to be the case.
        Thanks to @Nemo157 for the report (#46).
      - Fixed the parsing of prerelease and metadata parts to allow leading
        zeros for parts with non-numeric characters, e.g., `1.0.0-alpha.0a`, and
        to disallow parts with leading zeros and only numeric characters, e.g.,
        `1.0.0-02799`. Thanks to @Nemo157 for the bug report, and to Joseph
        Donahue for the SemVer spec expertise (#45).
      - The metadata part may no longer contain plus signs other than the one
        used to start the metadata part.
      - The prerelease and metadata parts may no longer start with a dot.

0.22.0  2020-04-02T14:13:55Z
      - Fixed `get_semver_prerelease()` so that it returns only the
        prerelease without any build metadata. For example, for
        `1.0.0-1.2+1.02`, it will now return `1.2`, not `1.2+1.02`. Thanks
        to Artur Troian for the report (#41) and fix (#42)!

0.21.0  2020-03-21T21:56:20Z
      - Fixed build metadata part to allow leading zeros. In other words,
        `1.0.0-1.02` is not a legitimate semver, because it has a leading zero
        in a numeric part of the prerelease version. `1.0.0-1.2+1.02`, however,
        is valid, because the leading zero numeric expression is in the build
        metadata part, which does not evaluate as numeric, and so is allowed.
        This fix allows source code hashes, for example, to be used in build
        metadata. Thanks to Artur Troian for the report (#38) and fix (#39)!

0.20.3  2018-11-10T19:32:26Z
      - Fixed test failure on Postgres 11 due to a renamed column that this
        extension doesn't even use for testing.

0.20.2  2018-10-19T02:05:11Z
      - Fix Makefile bug that installed the version script with the release
        version instead of the extension version. Thanks again to
        @ninjaslikecheese for the report (#33).

0.20.1  2018-10-18T00:30:04Z
      - Properly incremented version to v0.20.0 in the spec file and docs.
        Thanks to @ninjaslikecheese for the report (#32).

0.20.0  2018-10-17T12:59:22Z
      - Fixed file name in the v0.17.0 upgrade script.
      - Added the semverrange type.
      - Increased the minimum required version of PostgreSQL to 9.2 for range
        type support.
      - Fixed the `Makefile` so it properly installs `semver.sql`. Thanks to
        Matej Marušák for the report (Issue #31).

0.17.0  2017-05-07T07:15:25Z
      - Fixed potential memory leak in is_semver function. Thanks to
        Arun Tejasvi Chaganty (Issue #29).

0.16.0  2016-12-04T00:51:19Z
      - Added `get_semver_*` accessor functions to retrieve the individual
        parts of a semver, thanks to Geoff Montee (PR #27).

0.15.0  2016-10-28T03:38:59Z
      - Fixed incorrect parsing of semver build metadata.
      - Fixed text foratting of build metadata-only semver values.
      - Implemented pre-release precedence scheme as per semantic versioning
        2.0.0 section 11. Thanks to Sergey Kozlov for the report (Issue #23).
      - Added Xavier Caron and Tom Davis as maintainers.

0.14.0  2016-08-11T05:38:27Z
      - Updated the extension version in `semver.control` to 0.13.0, which
        evidently I forgot to do for that release. Thanks to Stanislav Lorenc
        for the report (Issue #21).

0.13.0  2016-07-30T21:06:15Z
      - Fixed bug where a dash (-) was disallowed within the metadata part of
        a semver. Thanks to @TerraTech for the report (Issue #19) and Tom
        Davis for the fix (PR #20).

0.12.0  2016-06-11T06:00:19Z
      - Fixed bug where some items described in the SemVer 2.0.0 Spec, section
        10, were not properly recognized as semvers. Thanks to Xavier Caron
        for the fix (with tests!) (PR #17).

0.11.0  2016-05-23T20:29:49Z
      - Added `is_semver()`, thanks to a pull request from Xavier Caron
        (PR #14).
      - Fixed bug where version parts with non-leading 0 were considered
        invalid. Thanks to @JeremySTX for the report (Issue #15) and Tom Davis
        for the fix (PR #16).

0.10.0  2016-05-12T00:28:03Z
      - Updated extension to support Semantic Versioning 2.0.0, thanks to Tom
        Davis (PR #13).
      - Improved error output to mark specific bad character, where possible,
        thanks to Tom Davis.
      - BREAKING CHANGE: `semver()` and cast constructors no longer support
        the semver 1.0.0-beta format format "X.Y.Zpre" (that is, without the
        dash), since it's not compatible with the semver 2.0.0 spec. Use
        `to_semver()` to convert it to X.Y.Z-pre", or specify "X.Y.Z-pre"
        directly.

0.5.0   2014-12-06T00:29:17Z
      - Fixed issue where the release file could be listed twice when
        installing, which causes an installation failure on some versions of
        PostgreSQL.
      - Fixed a typo in the README: `make installcheck` should be run *after*
        `make install`.
      - Fixed an issue where the installer would read the distribution version
        rather than the extension version. The latter is requierd to tell
        PostgreSQL the correct version number (since the distribution version
        is quite different from the extension version).
      - Added `LICENSE` file to simplify packaging, thanks to Richard Marko,
        who is packaging semver for Fedora.

0.4.0  2013-06-12T06:48:33Z
      - Updated the `Makefile` to reflect the recommended patterns from
        pgsql-hackers. Thanks to Cédric Villemain for the details.
      - Changed the Makefile to read the distribution name and version from
        META.json.
      - Fixed the Makefile to allow `PG_CONFIG=/path/to/pg_config` to actually
        work.
      - Fixed an off-by-one bug in the parser that could add garbage
        characters to the end of certain semvers with patch versions. Thanks
        to Andrew "RhodiumToad" Gierth for pointing out the bug.
      - Add a macro to fetch a semver from C function arguments, and cast to
        `semver*` rather than `void*`. Suggested by Andrew "RhodiumToad"
        Gierth.
      - Removed unnecessary calls to `PG_FREE_IF_COPY()`. Only really needed
        for toastable values, and semvers are not toastable.

0.3.0  2012-11-20T19:04:30Z
      - Updated the parser to support an optional dash before the prerelease
        version, and the formatter to always emit a dash for the prerelease
        version. This brings it in line with the final semver 1.0.0
        specification. Thanks to Pieter van de Bruggen for making it happen.

0.2.4  2012-11-02T22:32:30Z
      - Fixed a memory allocation bug that could cause semvers to be displayed
        with missing or garbage characters. Thanks to Andrew "RhodiumToad"
        Gierth for help tracking down and fixing the issue.

0.2.3 2011-11-11T06:55:10Z
      - Fixed the `Makefile` so that the documentation file should properly be
        found and installed by `PGXS`.

0.2.2   2011-05-12T19:01:41
      - Tweaked MultiMarkdown table layout in the docuemntation so that the
        header row is always processed as a header row, rather than a `pre`
        block.
      - Simplified the `CREATE EXTENSION` support in the `Makefile`.

0.2.1 2011-04-20T20:37:05
      - Fixed the metadata file to reflect that the "pair" extension is not
        included in the semver distribution.
      - Added abstract and doc file to the `provides` section of `META.json`.
      - Removed the `NO_PGXS` stuff from `Makefile`, as the PostgreSQL core
        team does not recommend its use outside of the core contrib
        extensions.
      - Added PostgreSQL 9.1 `CREATE EXTENSION` support, including migration
        from an unpackaged install via `CREATE EXTENSION semver FROM
        unpackaged`.
      - Renamed `doc/semver.md` to `doc/semver.mdd`, so that PGXN will parse
        it as MultiMarkdown. This will allow the tables to be properly
        formatted.
      - Removed documentation that semver is implemented as a domain. It
        hasn't been since 0.2.0.
      - Removed Unicode characters `psql` output in the documentation.

0.2.0 2011-02-05T19:32:49
      - Converted to a native type implemented in C by Sam Vilain. While David
        was at lunch, no less.
      - As a consequence, `USING` is no longer required in an `ORDER BY`
        clause to get proper semver sort ordering.
      - Added casts from nuermic types.
      - Renamed `clean_semver()` to `to_semver()`.

0.1.0  2010-10-07 18:31:43
      - Initial version.
      - Implementation in pure PL/pgSQL.
      - Included in [PGXN Manager](https://github.com/theory/pgxn-manager).
      - Not otherwise released.
