Skip to content

Commit b040e1d

Browse files
bitnerclaude
andcommitted
Add PGXN packaging: META.json, publishing CI, install + release docs
- META.json (PGXN Meta Spec 1.0.0): name, abstract, version 0.1.0, maintainer David Bitner <bitner@dbspatial.com>, MIT license, provides/prereqs/resources, release_status testing. - .github/workflows/release.yml: on a v* tag, validate+bundle+upload to PGXN via pgxn/pgxn-tools (needs PGXN_USERNAME / PGXN_PASSWORD secrets); guards that the tag matches META.json version. - .gitattributes: keep PLAN.md and .github/ out of the published tarball. - README: PGXN + CI badges, an Installation section (pgrx/cargo-pgrx, not PGXS), and a maintainer Releasing section. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 21194f6 commit b040e1d

4 files changed

Lines changed: 152 additions & 0 deletions

File tree

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PLAN.md export-ignore
2+
.github/ export-ignore
3+
/.gitattributes export-ignore

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release to PGXN
2+
3+
# Publishes a release to the PostgreSQL Extension Network (https://pgxn.org) when a
4+
# version tag is pushed. Requires two repository secrets, from a PGXN Manager account
5+
# (https://manager.pgxn.org): PGXN_USERNAME and PGXN_PASSWORD.
6+
#
7+
# To cut a release:
8+
# 1. Bump "version" in Cargo.toml and META.json (keep them identical).
9+
# 2. Commit, then tag: git tag v0.1.0 && git push origin v0.1.0
10+
# The tag (without its leading "v") must match the META.json version.
11+
12+
on:
13+
push:
14+
tags:
15+
- "v*"
16+
17+
jobs:
18+
release:
19+
name: Bundle and release on PGXN
20+
runs-on: ubuntu-latest
21+
container: pgxn/pgxn-tools
22+
env:
23+
PGXN_USERNAME: ${{ secrets.PGXN_USERNAME }}
24+
PGXN_PASSWORD: ${{ secrets.PGXN_PASSWORD }}
25+
steps:
26+
- name: Check out the release tag
27+
uses: actions/checkout@v4
28+
29+
- name: Verify META.json version matches the tag
30+
run: |
31+
meta="$(sed -n 's/^[[:space:]]*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' META.json | head -1)"
32+
tag="${GITHUB_REF_NAME#v}"
33+
echo "META.json version: '$meta' ; git tag: '$tag'"
34+
if [ "$meta" != "$tag" ]; then
35+
echo "::error::META.json version ($meta) does not match the tag ($tag)"
36+
exit 1
37+
fi
38+
39+
- name: Validate META.json and bundle the distribution
40+
run: pgxn-bundle
41+
42+
- name: Release on PGXN
43+
run: pgxn-release

META.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "pg_table_range",
3+
"abstract": "Planning-time partition pruning by per-partition data ranges, including non-key columns",
4+
"description": "pg_table_range prunes partitions at planning time from a compact per-partition summary of each column's actual data: its min/max range for btree-comparable scalar types, or a covering extent for range types and PostGIS geometry. Unlike native PostgreSQL partition pruning, it works on columns that are not the partition key. Summaries are stored in the index's own metapage and maintained incrementally on insert (like BRIN), so no REINDEX is needed, and pruning is conservative so results are always identical to running without it.",
5+
"version": "0.1.0",
6+
"maintainer": [
7+
"David Bitner <bitner@dbspatial.com>"
8+
],
9+
"license": "mit",
10+
"provides": {
11+
"pg_table_range": {
12+
"abstract": "Planning-time partition pruning by per-partition data ranges, including non-key columns",
13+
"file": "pg_table_range.control",
14+
"docfile": "README.md",
15+
"version": "0.1.0"
16+
}
17+
},
18+
"prereqs": {
19+
"runtime": {
20+
"requires": {
21+
"PostgreSQL": "16.0.0"
22+
}
23+
}
24+
},
25+
"resources": {
26+
"homepage": "https://github.com/bitner/pg_table_range",
27+
"bugtracker": {
28+
"web": "https://github.com/bitner/pg_table_range/issues"
29+
},
30+
"repository": {
31+
"url": "git://github.com/bitner/pg_table_range.git",
32+
"web": "https://github.com/bitner/pg_table_range",
33+
"type": "git"
34+
}
35+
},
36+
"generated_by": "David Bitner",
37+
"meta-spec": {
38+
"version": "1.0.0",
39+
"url": "https://pgxn.org/meta/spec.txt"
40+
},
41+
"tags": [
42+
"partitioning",
43+
"partition pruning",
44+
"performance",
45+
"planner",
46+
"brin",
47+
"postgis",
48+
"index access method"
49+
],
50+
"release_status": "testing"
51+
}

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
# pg_table_range: PostgreSQL data-range partition pruning
44

5+
[![PGXN version](https://badge.fury.io/pg/pg_table_range.svg)](https://pgxn.org/dist/pg_table_range/)
6+
[![CI](https://github.com/bitner/pg_table_range/actions/workflows/ci.yml/badge.svg)](https://github.com/bitner/pg_table_range/actions/workflows/ci.yml)
7+
58
A PostgreSQL 16+ extension that prunes partitions at planning time from a compact
69
per-partition summary of each column's **actual data** — its min/max range for scalar
710
columns, or its covering **extent** for range types and PostGIS geometry. This works on
@@ -26,6 +29,35 @@ without it.
2629
> [Scaling and partition count](#scaling-and-partition-count) for sizing. This is a
2730
> PostgreSQL limit on wide non-key access, not specific to this extension.
2831
32+
## Installation
33+
34+
This is a [pgrx](https://github.com/pgcentralfoundation/pgrx) (Rust) extension, so it is
35+
built and installed with `cargo pgrx` rather than a PGXS `make`. You need a Rust toolchain
36+
and `cargo-pgrx` matching the pgrx version this release pins (currently **0.18.1**):
37+
38+
```sh
39+
cargo install cargo-pgrx --version 0.18.1 --locked
40+
41+
# In a checkout of the source (from git or a PGXN download), install into the PostgreSQL
42+
# that `pg_config` points at. Match the feature flag to your server's major version:
43+
cargo pgrx install --release # PostgreSQL 18 (default)
44+
cargo pgrx install --release --no-default-features --features pg17 # PostgreSQL 17
45+
cargo pgrx install --release --no-default-features --features pg16 # PostgreSQL 16
46+
```
47+
48+
Use `--pg-config /path/to/pg_config` to target a specific PostgreSQL install. Then, in
49+
each database that should use it:
50+
51+
```sql
52+
CREATE EXTENSION pg_table_range;
53+
```
54+
55+
Supported: PostgreSQL 16, 17, and 18.
56+
57+
The distribution is also published on [PGXN](https://pgxn.org/dist/pg_table_range/). Note
58+
that `pgxn install` (which expects a PGXS Makefile) does **not** apply here; use
59+
`pgxn download pg_table_range`, unzip, and run `cargo pgrx install` as above.
60+
2961
## Quick Start
3062

3163
Summaries are built and maintained through a custom index access method, so pruning
@@ -282,6 +314,29 @@ PostGIS geometry test skips automatically where PostGIS is not installed; CI ins
282314
PostGIS so it runs there, and overlap pruning is also covered on every target by the
283315
range-type tests, which exercise the same code path.
284316

317+
## Releasing (maintainers)
318+
319+
The distribution is published to [PGXN](https://pgxn.org). Releases are automated by
320+
`.github/workflows/release.yml`, which runs on any `v*` tag and uses the
321+
[`pgxn/pgxn-tools`](https://github.com/pgxn/pgxn-tools) image to validate `META.json`,
322+
bundle the source, and upload it. One-time setup: add two repository secrets,
323+
`PGXN_USERNAME` and `PGXN_PASSWORD`, from a [PGXN Manager](https://manager.pgxn.org)
324+
account.
325+
326+
To cut a release:
327+
328+
1. Bump the version in **`Cargo.toml`** and **`META.json`** (keep them identical; the
329+
`.control` file's `default_version` is filled from `Cargo.toml` at build time).
330+
2. Commit, then tag and push — the tag without its leading `v` must equal the
331+
`META.json` version:
332+
333+
```sh
334+
git tag v0.1.0 && git push origin v0.1.0
335+
```
336+
337+
`META.json` describes the PGXN distribution; `PLAN.md` and `.github/` are excluded from
338+
the published tarball via `.gitattributes`.
339+
285340
## Limitations
286341

287342
- **Lock-table wall on many partitions.** Both `CREATE INDEX … USING table_range` and

0 commit comments

Comments
 (0)