PGXN RFCs — PGXN Book
The “RFC” (request for comments) process is intended to provide a consistent and controlled path for changes to PGXN and the PostgreSQL extension ecosystem, so that all stakeholders can be confident about the direction of the project.
All changes, including bug fixes, documentation improvements, and the introduction of new RFCs, can be implemented and reviewed via the normal GitHub pull request workflow.
Table of Contents
- Opening
- Table of Contents
- When you need to follow this process
- Before creating an RFC
- What the process is
- The RFC life-cycle
- Reviewing RFCs
- Implementing an RFC
- License
- Contributions
When you need to follow this process
You need to follow the PGXN RFC process to propose “substantial” changes to PGXN, its governance, packaging, and services, or the RFC process itself. What constitutes a “substantial” change evolves based on community norms and varies depending on what part of the ecosystem you are proposing to change, but may include the following.
- Any change to the metadata or distribution formats that is not a bugfix.
- Creating new services or features expected to be provided as part of PGXN.
- Removing features or decommissioning services
Some changes do not require an RFC:
- Rephrasing, reorganizing, refactoring, or otherwise “changing shape does not change meaning”.
- Additions that strictly improve objective, numerical quality criteria (performance improvements, better platform coverage, etc.)
Before creating an RFC
A hastily-proposed RFC can hurt its chances of acceptance. Low quality proposals, proposals for previously-rejected features, or those that don’t fit into the near-term roadmap may be quickly rejected — which can be demotivating for the unprepared contributor. Laying some groundwork ahead of the RFC can make the process smoother.
Although there is no single way to prepare for submitting an RFC, it is generally a good idea to pursue feedback from other project developers beforehand, to ascertain that the RFC may be desirable; having a consistent impact on the project requires concerted effort toward consensus-building.
The most common preparation for writing and submitting an RFC is talking the idea over on the PostgreSQL Slack.
What the process is
In short, to get a major feature added to PGXN, one must first get the RFC merged into the RFC repository as a markdown file. At that point the RFC is “active” and may be implemented with the goal of eventual inclusion in PGXN.
- Fork the RFC repo RFC repository
- Copy
0000-template.md
totext/0000-my-feature.md
(where “my-feature” is descriptive). Don’t assign an RFC number yet; This is going to be the PR number and we’ll rename the file accordingly if the RFC is accepted. - Fill in the RFC. Put care into the details: RFCs that do not present convincing motivation, demonstrate lack of understanding of the design’s impact, or are disingenuous about the drawbacks or alternatives tend to be poorly-received.
- Submit a pull request. As a pull request the RFC will receive design feedback from the broader community, and the author should be prepared to revise it in response.
- Now that your RFC has an open pull request, use the issue number of the PR
to rename the file: update your
0000-
prefix to that number. Also update the “RFC PR” link at the top of the file. - Build consensus and integrate feedback. RFCs that have broad support are much more likely to make progress than those that don’t receive any comments.
- The community will discuss the RFC pull request, as much as possible in the comment thread of the pull request itself. Offline discussion will be summarized on the pull request comment thread.
- RFCs rarely go through this process unchanged, especially as alternatives and drawbacks are shown. You can make edits, big and small, to the RFC to clarify or change the design, but make changes as new commits to the pull request, and leave a comment on the pull request explaining your changes. Specifically, do not squash or rebase commits after they are visible on the pull request.
- At some point, a PGXN maintainer will propose a “motion for final comment period” (FCP), along with a disposition for the RFC (merge, close, or postpone).
- The FCP lasts ten calendar days, so that it is open for at least 5 business days. It is also advertised widely, e.g., on Planet PostgreSQL. This way all stakeholders have a chance to lodge any final objections before a decision is reached.
- In most cases, the FCP period is quiet, and the RFC is either merged or closed. However, sometimes substantial new arguments or ideas are raised, the FCP is canceled, and the RFC goes back into development mode.
The RFC life-cycle
Once an RFC becomes “active”, where authors may implement it and submit the feature as a pull request to the appropriate PGXN repo. Being “active” is not a rubber stamp, and in particular still does not mean the feature will ultimately be merged; it does mean that in principle all the major stakeholders have agreed to the feature and are amenable to merging it.
Furthermore, the fact that a given RFC has been accepted and is “active” implies nothing about what priority is assigned to its implementation, nor does it imply anything about whether a PGXN developer has been assigned the task of implementing the feature. While it is not necessary that the author of the RFC also write the implementation, it is by far the most effective way to see an RFC through to completion: authors should not expect that other project developers will take on responsibility for implementing their accepted feature.
Modifications to “active” RFCs can be made in follow-up pull requests. We strive to write each RFC in a manner that it will reflect the final design of the feature; but the nature of the process means that we cannot expect every merged RFC to actually reflect what the end result will be at the time of the next major release.
In general, once accepted, RFCs should not be substantially changed. Only very minor changes should be submitted as amendments. More substantial changes should be submitted as new RFCs, with a note and link and added to the original RFC.
Reviewing RFCs
The PGXN maintainers make final decisions about RFCs after the benefits and drawbacks are well understood. When a decision is made, the RFC pull request will either be merged or closed. In either case, if the reasoning is not clear from the discussion in the pull request discussion, the maintainers will add a comment describing the rationale for the decision.
Implementing an RFC
Some accepted RFCs represent vital features that need to be implemented right away. Other accepted RFCs can represent features that can wait until some arbitrary developer feels like doing the work. Every accepted RFC has an associated issue tracking its implementation in the relevant PGXN repository; thus that associated issue can be assigned a priority via the triage process used for all PGXN issues.
The author of an RFC is not obligated to implement it. Of course, the RFC author (like any other developer) is welcome to post an implementation for review after the RFC has been accepted.
If you are interested in working on the implementation for an “active” RFC, but cannot determine if someone else is already working on it, feel free to ask (e.g. by leaving a comment on the associated issue).
License
This Book is distributed under the CC BY-SA 4.0 license.
Code Components extracted from this book document are licensed under the PostgreSQL License.
Contributions
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the PostgreSQL license, shall be dual licensed as above, without any additional terms or conditions.
- RFC: 1
- Title: Meta Spec v1
- Slug:
meta-spec
- Start Date: 2010-08-17
- Status: Standard
- Category: Packaging
- Pull Request: pgxn/rfcs#1
Name
PGXN Meta Spec - The PGXN distribution metadata specification
Version
1.0.2
Synopsis
{
"name": "pgTAP",
"abstract": "Unit testing for PostgreSQL",
"description": "pgTAP is a suite of database functions that make it easy to write TAP-emitting unit tests in psql scripts or xUnit-style test functions.",
"version": "0.26.0",
"maintainer": [
"David E. Wheeler <theory@pgxn.org>",
"pgTAP List <pgtap-users@googlegroups.com>"
],
"license": {
"PostgreSQL": "https://www.postgresql.org/about/licence"
},
"prereqs": {
"runtime": {
"requires": {
"plpgsql": 0,
"PostgreSQL": "8.0.0"
},
"recommends": {
"PostgreSQL": "8.4.0"
}
}
},
"provides": {
"pgtap": {
"file": "sql/pgtap.sql",
"docfile": "doc/pgtap.mmd",
"version": "0.2.4",
"abstract": "Unit testing assertions for PostgreSQL"
},
"schematap": {
"file": "sql/schematap.sql",
"docfile": "doc/schematap.mmd",
"version": "0.2.4",
"abstract": "Schema testing assertions for PostgreSQL"
}
},
"resources": {
"homepage": "https://pgtap.org/",
"bugtracker": {
"web": "https://github.com/theory/pgtap/issues"
},
"repository": {
"url": "https://github.com/theory/pgtap.git",
"web": "https://github.com/theory/pgtap",
"type": "git"
}
},
"generated_by": "David E. Wheeler",
"meta-spec": {
"version": "1.0.0",
"url": "https://pgxn.org/meta/spec.txt"
},
"tags": [
"testing",
"unit testing",
"tap",
"tddd",
"test driven database development"
]
}
Description
This document describes version 1.0.0 of the PGXN distribution metadata specification, also known as the “PGXN Meta Spec.” It is formatted using the MultiMarkdown variant of Markdown, and the canonical copy may always be found at master.pgxn.org/meta/spec.txt. A generated HTML-formatted copy found at pgxn.org/spec/ may also be considered canonical.
This document is stable. Any revisions to this specification for typo corrections and prose clarifications may be issued as “PGXN Meta Spec 1.0.x”. These revisions will never change semantics or add or remove specified behavior.
Distribution metadata describe important properties of PGXN distributions. Distribution building tools should create a metadata file in accordance with this specification and include it with the distribution for use by automated tools that index, examine, package, or install PGXN distributions.
Terminology
-
distribution: The primary object described by the metadata. In the context of this document it usually refers to a collection of extensions, source code, utilities, tests, and/or documents that are distributed together for other developers to use. Examples of distributions are
semver
,pair
, andpgTAP
. -
extension: A reusable library of code contained in a single file or within files referenced by the
CREATE EXTENSION
statement. Extensions usually contain one or more PostgreSQL objects — such as data types, functions, and operators — and are often referred to by the name of a primary object that can be mapped to the file name. For example, one might refer topgTAP
instead ofsql/pgtap.sql
. -
consumer: Code that reads a metadata file, deserializes it into a data structure in memory, or interprets a data structure of metadata elements.
-
producer: Code that constructs a metadata data structure, serializes into a byte stream and/or writes it to disk.
-
must, should, may, etc.: These terms are interpreted as described in IETF RFC 2119.
Data Types
Fields in the Structure section describe data elements, each of which has an associated data type as described herein. There are four primitive types: Boolean, String, List, and Map. Other types are subtypes of primitives and define compound data structures or define constraints on the values of a data element.
Boolean
A Boolean is used to provide a true or false value. It must be
represented as a defined (not null
) value.
String
A String is data element containing a non-zero length sequence of Unicode characters.
List
A List is an ordered collection of zero or more data elements. Elements of a List may be of mixed types.
Producers must represent List elements using a data structure which unambiguously indicates that multiple values are possible, such as a JavaScript array.
Consumers expecting a List must consider a String as equivalent to a List of length 1.
Map
A Map is an unordered collection of zero or more data elements (“values”), indexed by associated String elements (“keys”). The Map’s value elements may be of mixed types.
License String
A License String is a subtype of String with a restricted set of values. Valid values are described in detail in the description of the license field.
Term
A Term is a subtype of String that must be at least two
characters long contain no slash (/
), backslash (\
), control, or space
characters.
Tag
A Tag is a subtype of String that must be fewer than 256
characters long contain no slash (/
), backslash (\
), or control
characters.
URI
URI is a subtype of String containing a Uniform Resource Identifier or Locator.
Version
A Version is a subtype of String containing a value that describes the version number of extensions or distributions. Restrictions on format are described in detail in the Version Format section.
Version Range
The Version Range type is a subtype of String. It describes a range of Versions that may be present or installed to fulfill prerequisites. It is specified in detail in the Version Ranges section.
Structure
The metadata structure is a data element of type Map. This section describes valid keys within the Map.
Any keys not described in this specification document (whether top-level or
within compound data structures described herein) are considered custom keys
and must begin with an “x” or “X” and be followed by an underscore; i.e.,
they must match the pattern: /\Ax_/i
. If a custom key refers to a compound
data structure, subkeys within it do not need an “x_” or “X_” prefix.
Consumers of metadata may ignore any or all custom keys. All other keys not described herein are invalid and should be ignored by consumers. Producers must not generate or output invalid keys.
For each key, an example is provided followed by a description. The description begins with the version of spec in which the key was added or in which the definition was modified, whether the key is required or optional, and the data type of the corresponding data element. These items are in parentheses, brackets, and braces, respectively.
If a data type is a Map or Map subtype, valid subkeys will be described as well. All examples are represented as JSON.
Required Fields
abstract
Example:
"abstract": "Unit testing for PostgreSQL"
(Spec 1) [required] {String}
This is a short description of the purpose of the distribution.
maintainer
Examples:
"maintainer": "David E. Wheeler <theory@pgxn.org>"
"maintainer": [
"David E. Wheeler <theory@pgxn.org>",
"Josh Berkus <jberkus@pgxn.org>"
]
(Spec 1) [required] {List of one or more Strings}
This List indicates the person(s) to contact concerning the distribution. The preferred form of the contact string is:
contact-name <email-address>
This field provides a general contact list independent of other structured
fields provided within the resources field, such as
bugtracker
. The addressee(s) can be contacted for any purpose including but
not limited to: (security) problems with the distribution, questions about the
distribution, or bugs in the distribution.
A distribution’s original author is usually the contact listed within this field. Co-maintainers, successor maintainers, or mailing lists devoted to the distribution may also be listed in addition to or instead of the original author.
license
Examples:
"license": {
"PostgreSQL": "https://www.postgresql.org/about/licence"
}
"license": {
"Perl 5": "https://dev.perl.org/licenses/",
"BSD": "https://www.opensource.org/licenses/bsd-license.html"
}
"license": "perl_5"
"license": [ "apache_2_0", "mozilla_1_0" ]
(Spec 1) [required] {Map or List of one or more License Strings}
One or more licenses that apply to some or all of the files in the distribution. If multiple licenses are listed, the distribution documentation should be consulted to clarify the interpretation of multiple licenses.
The Map type describes the license or licenses. Each subkey may be any string naming a license. All values must be URIs that link to the appropriate license.
The List type may be used as a shortcut to identify one or more well-known licenses. The following list of License Strings are valid in the List representation:
string | description |
---|---|
agpl_3 | GNU Affero General Public License, Version 3 |
apache_1_1 | Apache Software License, Version 1.1 |
apache_2_0 | Apache License, Version 2.0 |
artistic_1 | Artistic License, (Version 1) |
artistic_2 | Artistic License, Version 2.0 |
bsd | BSD License (three-clause) |
freebsd | FreeBSD License (two-clause) |
gfdl_1_2 | GNU Free Documentation License, Version 1.2 |
gfdl_1_3 | GNU Free Documentation License, Version 1.3 |
gpl_1 | GNU General Public License, Version 1 |
gpl_2 | GNU General Public License, Version 2 |
gpl_3 | GNU General Public License, Version 3 |
lgpl_2_1 | GNU Lesser General Public License, Version 2.1 |
lgpl_3_0 | GNU Lesser General Public License, Version 3.0 |
mit | MIT (aka X11) License |
mozilla_1_0 | Mozilla Public License, Version 1.0 |
mozilla_1_1 | Mozilla Public License, Version 1.1 |
openssl | OpenSSL License |
perl_5 | The Perl 5 License (Artistic 1 & GPL 1 or later) |
postgresql | The PostgreSQL License |
qpl_1_0 | Q Public License, Version 1.0 |
ssleay | Original SSLeay License |
sun | Sun Internet Standards Source License (SISSL) |
zlib | zlib License |
The following License Strings are also valid and indicate other licensing not described above:
string | description |
---|---|
open_source | Other Open Source Initiative (OSI) approved license |
restricted | Requires special permission from copyright holder |
unrestricted | Not an OSI approved license, but not restricted |
unknown | License not provided in metadata |
All other strings are invalid in the license List.
provides
Example:
"provides": {
"pgtap": {
"file": "sql/pgtap.sql",
"docfile": "doc/pgtap.mmd",
"version": "0.2.4",
"abstract": "Unit testing assertions for PostgreSQL"
},
"schematap": {
"file": "sql/schematap.sql",
"docfile": "doc/schematap.mmd",
"version": "0.2.4",
"abstract": "Schema testing assertions for PostgreSQL"
}
}
(Spec 1) [required] {Map of Terms}
This describes all extensions provided by this distribution. This information is used by PGXN to build indexes identifying in which distributions various extensions can be found.
The keys of provides
are Terms that name the extensions found
within the distribution. The values are Maps with the following
subkeys:
-
file: The value must contain a relative file path from the root of the distribution to the file containing the extension. The path must be specified with unix conventions. Required.
-
version: This field contains a Version for the extension. All extensions must have versions. Required.
-
abstract: A short String value describing the extension. Optional.
-
docfile: The value must contain a relative file path from the root of the distribution to the file containing documentation for the extension. The path must be specified with unix conventions. Optional.
meta-spec
Example:
"meta-spec": {
"version": "1.0.0",
"url": "https://pgxn.org/meta/spec.txt"
}
(Spec 1) [required] {Map}
This field indicates the Version of the PGXN Meta Spec that should be used to interpret the metadata. Consumers must check this key as soon as possible and abort further metadata processing if the meta-spec Version is not supported by the consumer.
The following keys are valid, but only version
is required.
-
version: This subkey gives the integer Version of the PGXN Meta Spec against which the document was generated.
-
url: This is a URI of the metadata specification document corresponding to the given version. This is strictly for human-consumption and should not impact the interpretation of the document.
name
Example:
"name": "pgTAP"
(Spec 1) [required] {Term}
This field is the name of the distribution. This is usually the same as the name of the “main extension” in the distribution, but may be completely unrelated to the extensions within the distribution. This value will be used in the distribution file name on PGXN.
version
Example:
"version": "1.3.6"
(Spec 1) [required] {Version}
This field gives the version of the distribution to which the metadata structure refers. Its value must be a Version.
Optional Fields
description
Example:
"description": "pgTAP is a suite of database functions that make it easy to write TAP-emitting unit tests in psql scripts or xUnit-style test functions."
(Spec 1) [optional] {String}
A longer, more complete description of the purpose or intended use of the
distribution than the one provided by the abstract
key.
generated_by
Example:
"generated_by": "Module::Build::PGXN version 0.42"
(Spec 1) [optional] {String}
This field indicates the tool that was used to create this metadata. There are no defined semantics for this field, but it is traditional to use a string in the form “Software package version 1.23” or the maintainer’s name, if the file was generated by hand.
tags
Example:
"tags": [ "testing", "unit testing", "tap" ]
(Spec 1) [optional] {List of Tags}
A List of keywords that describe this distribution.
no_index
Example:
"no_index": {
"file": [ "src/file.sql" ],
"directory": [ "src/private" ]
}
(Spec 1) [optional] {Map}
This Map describes any files or directories that are private to the packaging or implementation of the distribution and should be ignored by indexing or search tools.
Valid subkeys are as follows:
-
file: A List of relative paths to files. Paths must be specified with unix conventions.
-
directory: A List of relative paths to directories. Paths must be specified with unix conventions.
prereqs
Example:
"prereqs": {
"runtime": {
"requires": {
"PostgreSQL": "8.0.0",
"PostGIS": "1.5.0"
},
"recommends": {
"PostgreSQL": "8.4.0"
},
"suggests": {
"sha1": 0
}
},
"build": {
"requires": {
"prefix": 0
}
},
"test": {
"recommends": {
"pgTAP": 0
}
}
}
(Spec 1) [optional] {Map}
This is a Map that describes all the prerequisites of the
distribution. The keys are phases of activity, such as configure
, build
,
test
, or runtime
. Values are Maps in which the keys name the type
of prerequisite relationship such as requires
, recommends
, suggests
, or
conflicts
, and the values provide sets of prerequisite relations. The sets
of relations must be specified as Maps of extension names to
Version Ranges.
The full definition for this field is given in the Prereq Spec section.
release_status
Example:
"release_status": "stable"
(Spec 1) [optional] {String}
This field specifies the release status of this distribution. It must have one of the following values:
-
stable: Indicates an ordinary, “final” release that should be indexed by PGXN.
-
testing: Indicates a “beta” release that is substantially complete, but has an elevated risk of bugs and requires additional testing. The distribution should not be installed over a stable release without an explicit request or other confirmation from a user. This release status may also be used for “release candidate” versions of a distribution.
-
unstable: Indicates an “alpha” release that is under active development, but has been released for early feedback or testing and may be missing features or may have serious bugs. The distribution should not be installed over a stable release without an explicit request or other confirmation from a user.
Consumers may use this field to determine how to index the distribution for PGXN or other repositories. If this field is not present, consumers may assume that the distribution status is “stable.”
resources
Example:
"resources": {
"homepage": "https://pgxn.org/",
"bugtracker": {
"web": "https://github.com/theory/pgtap/issues",
"mailto": "pgxn-bugs@example.com"
},
"repository": {
"url": "git://github.com/theory/pgtap.git",
"web": "https://github.com/theory/pgtap/",
"type": "git"
},
"x_twitter": "https://twitter.com/pgtap/"
}
(Spec 1) [optional] {Map}
This field describes resources related to this distribution.
Valid subkeys include:
-
homepage: A URI for the official home of this project on the web.
-
bugtracker: This entry describes the bug tracking system for this distribution. It is a Map with the following valid keys:
- web: a URI pointing to a web front-end for the bug tracker
- mailto: an email address to which bug reports can be sent
-
repository: This entry describes the source control repository for this distribution. It is a Map with the following valid keys:
- url: a URI pointing to the repository itself
- web: a URI pointing to a web front-end for the repository
- type: a lowercase string indicating the VCS used
Because a URI like
https://myrepo.example.com/
is ambiguous as to type, producers should provide atype
whenever aurl
key is given. Thetype
field should be the name of the most common program used to work with the repository, e.g. git, svn, cvs, darcs, bzr or hg.
Version Numbers
Version Format
This section defines the Version type, used by several fields in the PGXN Meta Spec.
Version numbers must be treated as strings, and adhere to the Semantic Versioning 2.0.0 Specification. Semantic versions take a dotted-integer format consisting of three positive integers separated by full stop characters (i.e. “dots”, “periods” or “decimal points”). A “pre-release version” may be denoted by appending a dash followed by an arbitrary ASCII string immediately following the patch version. Please see the specification for all details on the format.
Version Ranges
Some fields (prereqs
) indicate the particular version(s) of some other
extension that may be required as a prerequisite. This section details the
Version Range type used to provide this information.
The simplest format for a Version Range is just the version number itself,
e.g. 2.4.0
. This means that at least version 2.4.0 must be present. To
indicate that any version of a prerequisite is okay, even if the
prerequisite doesn’t define a version at all, use the version 0
.
Alternatively, a version range may use the operators <
(less than), <=
(less than or equal), >
(greater than), >=
(greater than or equal), ==
(equal), and !=
(not equal). For example, the specification < 2.0.0
means
that any version of the prerequisite less than 2.0.0 is suitable.
For more complicated situations, version specifications may be AND-ed
together using commas. The specification >= 1.2.0, != 1.5.0, < 2.0.0
indicates a version that must be at least 1.2.0, less than 2.0.0, and
not equal to 1.5.0.
Prerequisites
Prereq Spec
The prereqs
key defines the relationship between a distribution and other
extensions. The prereq spec structure is a hierarchical data structure which
divides prerequisites into Phases of activity in the installation process
and Relationships that indicate how prerequisites should be resolved.
For example, to specify that pgtap
is required during the test
phase, this
entry would appear in the distribution metadata:
"prereqs": {
"test": {
"requires": {
"pgtap": 0
}
}
}
Note that the prereqs
key may not be used to specify prerequisites
distributed outside PGXN or the PostgreSQL core and its contrib extensions.
Phases
Requirements for regular use must be listed in the runtime
phase. Other
requirements should be listed in the earliest stage in which they are required
and consumers must accumulate and satisfy requirements across phases before
executing the activity. For example, build
requirements must also be
available during the test
phase.
before action | requirements that must be met |
---|---|
./configure | configure |
make | configure, runtime, build |
make test | configure, runtime, build, test |
Consumers that install the distribution must ensure that runtime requirements are also installed and may install dependencies from other phases.
after action | requirements that must be met |
---|---|
make install | runtime |
-
configure: The configure phase occurs before any dynamic configuration has been attempted. Extensions required by the configure phase must be available for use before the distribution building tool has been executed.
-
build: The build phase is when the distribution’s source code is compiled (if necessary) and otherwise made ready for installation.
-
test: The test phase is when the distribution’s automated test suite is run. Any extension needed only for testing and not for subsequent use should be listed here.
-
runtime: The runtime phase refers not only to when the distribution’s contents are installed, but also to its continued use. Any extension that is a prerequisite for regular use of this distribution should be indicated here.
-
develop: The develop phase’s prereqs are extensions needed to work on the distribution’s source code as its maintainer does. These tools might be needed to build a release tarball, to run maintainer-only tests, or to perform other tasks related to developing new versions of the distribution.
Relationships
-
requires: These dependencies must be installed for proper completion of the phase.
-
recommends: Recommended dependencies are strongly encouraged and should be satisfied except in resource constrained environments.
-
suggests: These dependencies are optional, but are suggested for enhanced operation of the described distribution.
-
conflicts: These dependencies cannot be installed when the phase is in operation. This is a very rare situation, and the conflicts relationship should be used with great caution, or not at all.
Merging and Resolving Prerequisites
Whenever metadata consumers merge prerequisites, they should be merged in a way that preserves the intended semantics of the prerequisite structure. Generally, this means concatenating the version specifications using commas, as described in the Version Ranges section.
A subtle error that can occur when resolving prerequisites comes from the way that extensions in prerequisites are indexed to distribution files on PGXN. When a extension is deleted from a distribution, prerequisites calling for that extension could indicate that an older distribution should installed, potentially overwriting files from a newer distribution.
For example, say the PGXN index contained these extension-distribution mappings:
Extension | Version | Distribution |
---|---|---|
pgtap | 0.25.0 | pgtap-0.25.0.zip |
schematap | 0.25.0 | pgtap-0.25.0.zip |
functap | 0.18.1 | pgtap-0.18.1.zip |
Note that functap was removed from the pgtap distribution sometime after
0.18.1. Consider the case where pgtap 0.25.0 is installed. If a distribution
specified “functap” as a prerequisite, it could result in
pgtap-0.18.1.tar.gz
being installed, overwriting any files from
pgtap-0.25.0.zip
.
Consumers of metadata should test whether prerequisites would result in installed module files being “downgraded” to an older version and may warn users or ignore the prerequisite that would cause such a result.
Serialization
Distribution metadata should be serialized as JSON-encoded data and packaged
with distributions as the file META.json
.
Notes For Implementors
Comparing Version Numbers
Following the Semantic Versioning 2.0.0 Spec, version numbers must be strictly compared by splitting the Version string on full stop characters (i.e. “dots”, “periods” or “decimal points”) and comparing each of the three parts as integers. If a dash and prerelease ASCII string has been appended to the third number, it will be extracted and compared in ASCII-betical order, and in any event will be considered to be less than an un-encumbered third integer of the same value. Some examples:
0.12.1 < 0.12.2
1.42.0 > 1.41.99
2.0.0 > 1.999.999
2.0.0alpha3 < 2.0.0beta1
2.0.0beta < 2.0.0
See Also
Contributors
The PGXN Meta Spec borrows heavily from the CPAN Meta Spec, which was originally written by Ken Williams in 2003 and has since been updated by Randy Sims, David Golden, and Ricardo Signes. Ported to PGXN by David E. Wheeler.