pg_projection
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
pg_projection | 1.0.0 | SIM | MIT | SQL |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 9090 | pg_projection | No | No | No | Yes | No | Yes | - |
SQL-only extension.
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.0.0 | 1817161514 | pg_projection | - |
| RPM | PIGSTY | 1.0.0 | 1817161514 | pg_projection_$v | - |
| DEB | PIGSTY | 1.0.0 | 1817161514 | postgresql-$v-pg-projection | - |
| OS / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
| el8.x86_64 | PIGSTY 1.0.0 el8.x86_64.pg18 : pg_projection_18 pg_projection_18-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.x86_64.pg17 : pg_projection_17 pg_projection_17-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.x86_64.pg16 : pg_projection_16 pg_projection_16-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.x86_64.pg15 : pg_projection_15 pg_projection_15-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.x86_64.pg14 : pg_projection_14 pg_projection_14-1.0.0-1PIGSTY.el8.noarch.rpm
|
| el8.aarch64 | PIGSTY 1.0.0 el8.aarch64.pg18 : pg_projection_18 pg_projection_18-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.aarch64.pg17 : pg_projection_17 pg_projection_17-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.aarch64.pg16 : pg_projection_16 pg_projection_16-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.aarch64.pg15 : pg_projection_15 pg_projection_15-1.0.0-1PIGSTY.el8.noarch.rpm
| PIGSTY 1.0.0 el8.aarch64.pg14 : pg_projection_14 pg_projection_14-1.0.0-1PIGSTY.el8.noarch.rpm
|
| el9.x86_64 | PIGSTY 1.0.0 el9.x86_64.pg18 : pg_projection_18 pg_projection_18-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.x86_64.pg17 : pg_projection_17 pg_projection_17-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.x86_64.pg16 : pg_projection_16 pg_projection_16-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.x86_64.pg15 : pg_projection_15 pg_projection_15-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.x86_64.pg14 : pg_projection_14 pg_projection_14-1.0.0-1PIGSTY.el9.noarch.rpm
|
| el9.aarch64 | PIGSTY 1.0.0 el9.aarch64.pg18 : pg_projection_18 pg_projection_18-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.aarch64.pg17 : pg_projection_17 pg_projection_17-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.aarch64.pg16 : pg_projection_16 pg_projection_16-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.aarch64.pg15 : pg_projection_15 pg_projection_15-1.0.0-1PIGSTY.el9.noarch.rpm
| PIGSTY 1.0.0 el9.aarch64.pg14 : pg_projection_14 pg_projection_14-1.0.0-1PIGSTY.el9.noarch.rpm
|
| el10.x86_64 | PIGSTY 1.0.0 el10.x86_64.pg18 : pg_projection_18 pg_projection_18-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.x86_64.pg17 : pg_projection_17 pg_projection_17-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.x86_64.pg16 : pg_projection_16 pg_projection_16-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.x86_64.pg15 : pg_projection_15 pg_projection_15-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.x86_64.pg14 : pg_projection_14 pg_projection_14-1.0.0-1PIGSTY.el10.noarch.rpm
|
| el10.aarch64 | PIGSTY 1.0.0 el10.aarch64.pg18 : pg_projection_18 pg_projection_18-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.aarch64.pg17 : pg_projection_17 pg_projection_17-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.aarch64.pg16 : pg_projection_16 pg_projection_16-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.aarch64.pg15 : pg_projection_15 pg_projection_15-1.0.0-1PIGSTY.el10.noarch.rpm
| PIGSTY 1.0.0 el10.aarch64.pg14 : pg_projection_14 pg_projection_14-1.0.0-1PIGSTY.el10.noarch.rpm
|
| d12.x86_64 | PIGSTY 1.0.0 d12.x86_64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.x86_64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.x86_64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.x86_64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.x86_64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
|
| d12.aarch64 | PIGSTY 1.0.0 d12.aarch64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.aarch64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.aarch64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.aarch64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
| PIGSTY 1.0.0 d12.aarch64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~bookworm_all.deb
|
| d13.x86_64 | PIGSTY 1.0.0 d13.x86_64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.x86_64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.x86_64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.x86_64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.x86_64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
|
| d13.aarch64 | PIGSTY 1.0.0 d13.aarch64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.aarch64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.aarch64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.aarch64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
| PIGSTY 1.0.0 d13.aarch64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~trixie_all.deb
|
| u22.x86_64 | PIGSTY 1.0.0 u22.x86_64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.x86_64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.x86_64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.x86_64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.x86_64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
|
| u22.aarch64 | PIGSTY 1.0.0 u22.aarch64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.aarch64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.aarch64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.aarch64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
| PIGSTY 1.0.0 u22.aarch64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~jammy_all.deb
|
| u24.x86_64 | PIGSTY 1.0.0 u24.x86_64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.x86_64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.x86_64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.x86_64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.x86_64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~noble_all.deb
|
| u24.aarch64 | PIGSTY 1.0.0 u24.aarch64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.aarch64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.aarch64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.aarch64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~noble_all.deb
| PIGSTY 1.0.0 u24.aarch64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~noble_all.deb
|
| u26.x86_64 | PIGSTY 1.0.0 u26.x86_64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.x86_64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.x86_64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.x86_64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.x86_64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
|
| u26.aarch64 | PIGSTY 1.0.0 u26.aarch64.pg18 : postgresql-18-pg-projection postgresql-18-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.aarch64.pg17 : postgresql-17-pg-projection postgresql-17-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.aarch64.pg16 : postgresql-16-pg-projection postgresql-16-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.aarch64.pg15 : postgresql-15-pg-projection postgresql-15-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
| PIGSTY 1.0.0 u26.aarch64.pg14 : postgresql-14-pg-projection postgresql-14-pg-projection_1.0.0-1PIGSTY~resolute_all.deb
|
Build
You can build the RPM / DEB packages for pg_projection using pig build:
Install
You can install pg_projection directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
Install the extension using pig or apt/yum/dnf:
Create Extension:
Usage
Sources: pg_projection README, SQL definitions, control file.
pg_projection provides MongoDB-style read projections for PostgreSQL jsonb. The 1.0 SQL file defines two functions: pg_project(jsonb, jsonb) for one JSON document and pg_project_set(text, jsonb) for a query result converted to a JSON array.
Project One JSONB Value
Projection values are numeric flags: 1 includes a field and 0 excludes a field.
In inclusion mode, _id is included by default when present. Exclude it explicitly when the caller wants only the selected fields:
Exclude Fields
When the projection uses 0, the function starts from the original document and removes matching top-level keys:
Project A Query Result
pg_project_set(query_text, projection_json) executes the supplied SQL text, converts each row with to_jsonb(t), applies pg_project, and returns a JSON array:
Because query_text is dynamic SQL, pass only trusted query strings assembled by application or migration code you control. Do not concatenate untrusted user input into this argument.
Caveats
- The SQL implementation projects top-level keys; it does not implement nested MongoDB path projection.
- Projection values are cast to integers internally, so use numeric
0and1flags. pg_project(jsonb, jsonb)is declaredIMMUTABLE STRICT;pg_project_set(text, jsonb)is declaredSTABLE.
Was this page helpful?
Thanks—your feedback helps us improve this page.
What got in the way? (optional)