Skip to content

Commit 66ab1db

Browse files
committed
update extension docs
1 parent ea27230 commit 66ab1db

File tree

451 files changed

+29174
-73
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

451 files changed

+29174
-73
lines changed

content/_index.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ comment: false
1212

1313
PGEXT.CLOUD provides three things to help you harness the synergistic superpower of the PostgreSQL extensions ecosystem:
1414

15-
- [**Catalog**](/list) : Find the extension you need, with unparalleled [**461**](/e/) extensions included
15+
- [**Catalog**](/list) : Find the extension you need, with unparalleled [**464**](/e/) extensions included
1616
- [**Repository**](/repo) : Get pre-built RPM/DEB packages on **14** mainstream [**Linux Distributions**](/os)
1717
- [**PIG Package Manager**](/pig/) : The Missing Package Manager for PostgreSQL & Extension Ecosystem
1818

1919
{{< cards cols=4 >}}
20-
{{< card link="/list" title="Extension Catalog" icon="clipboard-list" subtitle="The complete list of 461 available PostgreSQL extensions" >}}
20+
{{< card link="/list" title="Extension Catalog" icon="clipboard-list" subtitle="The complete list of 464 available PostgreSQL extensions" >}}
2121
{{< card link="/repo" title="Software Repository" icon="cube" subtitle="The APT / DNF repo that deliver PostgreSQL extensions in native Linux format" >}}
2222
{{< card link="/pig" title="Package Manager" icon="cash" subtitle="The missing package manager for PostgreSQL & Extensions Ecosystem" >}}
2323
{{< /cards >}}
@@ -37,7 +37,7 @@ pig install pg_duckdb -v 18 # e.g. install pg_duckdb extension for PG 18
3737

3838
## Highlights
3939

40-
- **461 Extensions** : the largest catalog in the postgres ecosystem
40+
- **464 Extensions** : the largest catalog in the postgres ecosystem
4141
- **Linux Native** : RPM/DEB packages, properly built, freely compose
4242
- **Handy CLI** : pig on apt/dnf, zero‑config installs; out-of-the-box
4343
- **Compatibility** : PGDG‑Compliant, drop‑in with official PG kernel
@@ -128,7 +128,7 @@ Pigsty provides complete extension support on these [linux distributions](/os) m
128128
The **PGSTY.CLOUD** is used by some PostgreSQL Distribution Maker and Vendors to deliver PG extensions to their users and customers.
129129

130130
{{< cards cols=1 >}}
131-
{{< card link="https://github.com/pgsty/pigsty" title="Pigsty" icon="github" subtitle="Battery-Included Local-First PostgreSQL Distribution as an Open Source RDS, with HA, PITR, IaC, Observability and 461 extensions!" >}}
131+
{{< card link="https://github.com/pgsty/pigsty" title="Pigsty" icon="github" subtitle="Battery-Included Local-First PostgreSQL Distribution as an Open Source RDS, with HA, PITR, IaC, Observability and 464 extensions!" >}}
132132
{{< /cards >}}
133133

134134
{{< cards cols=2 >}}

content/_index.zh.md

Lines changed: 22 additions & 22 deletions
Large diffs are not rendered by default.

content/e/acl.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,3 +199,73 @@ pig install acl -v 14; # install for PG 14
199199
```sql
200200
CREATE EXTENSION acl;
201201
```
202+
203+
204+
205+
## Usage
206+
207+
> [acl: access control list data type for PostgreSQL](https://github.com/arkhipov/acl)
208+
209+
The `acl` extension provides Access Control List types for row-level security based on application users, without requiring separate database accounts.
210+
211+
```sql
212+
CREATE EXTENSION acl;
213+
```
214+
215+
### Data Types
216+
217+
- **`ace`**: Standard role-based ACE using PostgreSQL OIDs
218+
- **`ace_int4`**: ACE with 32-bit integer identifiers
219+
- **`ace_int8`**: ACE with 64-bit integer identifiers
220+
- **`ace_uuid`**: ACE with UUID identifiers
221+
222+
ACLs are stored as PostgreSQL arrays of ACE types (e.g., `ace[]`).
223+
224+
### ACE Format
225+
226+
```
227+
[type]/[flags]/[who]=[mask]
228+
```
229+
230+
- **Type**: `a` (allow) or `d` (deny)
231+
- **Flags**: `i` (inherit only), `o` (object inherit), `c` (container inherit), `p` (no propagate), `h` (inherited)
232+
- **Who**: Role name, OID, integer, UUID, or `""` (everyone)
233+
- **Permissions**: `r` (read), `w` (write), `d` (delete), `c` (read ACL), `s` (write ACL), plus 16 custom permissions (0-F)
234+
235+
### Checking Permissions
236+
237+
```sql
238+
-- Check current user's access
239+
SELECT acl_check_access(acl_column, 'rw', false) FROM my_table;
240+
241+
-- Check specific role
242+
SELECT acl_check_access(acl_column, 'r', 'username'::name, false);
243+
244+
-- Check custom int4 roles
245+
SELECT acl_check_access(acl_column, 'rw', ARRAY[1001, 1002]::int4[], false);
246+
```
247+
248+
### ACL Inheritance
249+
250+
```sql
251+
-- Compute child ACL from parent
252+
SELECT acl_merge(parent_acl, child_acl, true, true);
253+
```
254+
255+
### Row-Level Security Example
256+
257+
```sql
258+
CREATE TABLE file_system (
259+
id int PRIMARY KEY,
260+
name text,
261+
acl ace[]
262+
);
263+
264+
ALTER TABLE file_system ENABLE ROW LEVEL SECURITY;
265+
266+
CREATE POLICY read_policy ON file_system FOR SELECT TO PUBLIC
267+
USING (acl_check_access(acl, 'r', false) = 'r');
268+
269+
CREATE POLICY write_policy ON file_system FOR UPDATE TO PUBLIC
270+
USING (acl_check_access(acl, 'w', false) = 'w');
271+
```

content/e/address_standardizer.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,97 @@ pig install address_standardizer -v 14; # install for PG 14
9090
```sql
9191
CREATE EXTENSION address_standardizer;
9292
```
93+
94+
95+
96+
## Usage
97+
98+
> [Address Standardizer: Address parsing and standardization for PostGIS](https://github.com/postgis/postgis)
99+
100+
The Address Standardizer is a PostGIS extension that parses a single-line address string into a structured form using configurable lexicon, grammar, and rules tables. It is a more flexible alternative to the built-in `normalize_address` function in the TIGER geocoder.
101+
102+
- [Address Standardizer Reference](https://postgis.net/docs/Extras.html#Address_Standardizer)
103+
104+
### Setup
105+
106+
```sql
107+
CREATE EXTENSION address_standardizer;
108+
```
109+
110+
--------
111+
112+
## Standardizing Addresses
113+
114+
The core function takes an address string and three table references (lex, gaz, rules):
115+
116+
```sql
117+
SELECT *
118+
FROM standardize_address(
119+
'us_lex', -- lexicon table
120+
'us_gaz', -- gazetteer table
121+
'us_rules', -- rules table
122+
'1600 Pennsylvania Ave NW, Washington, DC 20500'
123+
);
124+
```
125+
126+
The result contains structured fields:
127+
128+
| Field | Description |
129+
|-------|-------------|
130+
| `building` | Building name or identifier |
131+
| `house_num` | Street number |
132+
| `predir` | Prefix direction (N, S, E, W) |
133+
| `qual` | Qualifier |
134+
| `pretype` | Prefix type |
135+
| `name` | Street name |
136+
| `suftype` | Suffix type (St, Ave, Blvd) |
137+
| `sufdir` | Suffix direction |
138+
| `ruralroute` | Rural route |
139+
| `extra` | Extra information |
140+
| `city` | City name |
141+
| `state` | State |
142+
| `country` | Country |
143+
| `postcode` | ZIP/postal code |
144+
| `box` | PO Box |
145+
| `unit` | Unit/apartment number |
146+
147+
--------
148+
149+
## Lexicon, Gazetteer, and Rules Tables
150+
151+
The standardizer is driven by three user-configurable tables:
152+
153+
**Lexicon (lex)** -- Maps input tokens to standardized forms and token classes:
154+
155+
```sql
156+
CREATE TABLE us_lex (
157+
id serial PRIMARY KEY,
158+
seq integer,
159+
word text,
160+
stdword text,
161+
token integer
162+
);
163+
```
164+
165+
**Gazetteer (gaz)** -- Maps place names (cities, states) to standard forms:
166+
167+
```sql
168+
CREATE TABLE us_gaz (
169+
id serial PRIMARY KEY,
170+
seq integer,
171+
word text,
172+
stdword text,
173+
token integer
174+
);
175+
```
176+
177+
**Rules (rules)** -- Defines grammar rules for parsing addresses:
178+
179+
```sql
180+
CREATE TABLE us_rules (
181+
id serial PRIMARY KEY,
182+
rule text
183+
);
184+
```
185+
186+
For US addresses, the `address_standardizer_data_us` extension provides pre-built data for these tables.

content/e/address_standardizer_data_us.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,43 @@ pig install address_standardizer_data_us -v 14; # install for PG 14
9090
```sql
9191
CREATE EXTENSION address_standardizer_data_us;
9292
```
93+
94+
95+
96+
## Usage
97+
98+
> [Address Standardizer Data US: US address data for the address_standardizer extension](https://github.com/postgis/postgis)
99+
100+
This extension provides pre-built US lexicon, gazetteer, and rules data for use with the `address_standardizer` extension. It includes tables with common US street types, directional abbreviations, state names, and grammar rules needed to parse US addresses.
101+
102+
- [Address Standardizer Reference](https://postgis.net/docs/Extras.html#Address_Standardizer)
103+
104+
### Setup
105+
106+
```sql
107+
CREATE EXTENSION address_standardizer_data_us;
108+
```
109+
110+
This creates the `us_lex`, `us_gaz`, and `us_rules` tables in the public schema, pre-populated with US address data.
111+
112+
--------
113+
114+
## Using with address_standardizer
115+
116+
Once installed, you can immediately standardize US addresses:
117+
118+
```sql
119+
SELECT *
120+
FROM standardize_address(
121+
'us_lex', 'us_gaz', 'us_rules',
122+
'123 Main Street NW, Apt 4B, Springfield, IL 62704'
123+
);
124+
```
125+
126+
The provided data covers common US address patterns including:
127+
128+
- Street types (Street, Avenue, Boulevard, Drive, Lane, Court, etc.)
129+
- Directional prefixes and suffixes (North, South, N, S, NW, SE, etc.)
130+
- State names and abbreviations
131+
- Unit designators (Apt, Suite, Unit, etc.)
132+
- Highway designators (US, State, County, Interstate, etc.)

content/e/adminpack.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,61 @@ width: full
4444
```sql
4545
CREATE EXTENSION adminpack;
4646
```
47+
48+
49+
50+
51+
## Usage
52+
53+
> [adminpack: administrative functions for PostgreSQL](https://www.postgresql.org/docs/16/adminpack.html)
54+
55+
The `adminpack` extension provides server-side file management and log access functions, primarily used by pgAdmin and other administration tools. All functions are restricted to superusers by default.
56+
57+
### File Operations
58+
59+
```sql
60+
-- Write text to a file (append=false: file must not exist; append=true: append)
61+
SELECT pg_file_write('/tmp/test.txt', 'Hello World', false); -- returns bytes written
62+
63+
-- Append to existing file
64+
SELECT pg_file_write('/tmp/test.txt', E'\nMore data', true);
65+
66+
-- Sync file to disk
67+
SELECT pg_file_sync('/tmp/test.txt');
68+
69+
-- Rename a file
70+
SELECT pg_file_rename('/tmp/old.txt', '/tmp/new.txt');
71+
72+
-- Rename with archiving (moves existing newname to archive first)
73+
SELECT pg_file_rename('/tmp/old.txt', '/tmp/new.txt', '/tmp/archive.txt');
74+
75+
-- Delete a file
76+
SELECT pg_file_unlink('/tmp/test.txt'); -- returns true on success
77+
```
78+
79+
### Log File Access
80+
81+
```sql
82+
-- List server log files (requires default log_filename format)
83+
SELECT * FROM pg_logdir_ls();
84+
```
85+
86+
Returns timestamps and paths of log files from the `log_directory`.
87+
88+
### Function Reference
89+
90+
| Function | Returns | Description |
91+
|----------|---------|-------------|
92+
| `pg_file_write(filename, data, append)` | bigint | Write text to file; returns bytes written |
93+
| `pg_file_sync(filename)` | void | Flush file or directory to disk |
94+
| `pg_file_rename(old, new [, archive])` | boolean | Rename file, optionally archiving existing target |
95+
| `pg_file_unlink(filename)` | boolean | Delete a file |
96+
| `pg_logdir_ls()` | setof record | List log files with timestamps |
97+
98+
### Access Control
99+
100+
- All functions default to superuser-only access
101+
- Permissions can be granted via `GRANT` to non-superusers
102+
- File access is restricted to the database cluster directory unless the user has `pg_read_server_files` or `pg_write_server_files` roles
103+
104+
Note: `adminpack` was removed in PostgreSQL 17. For PostgreSQL 16 and earlier only.

content/e/age.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,83 @@ pig install age -v 14; # install for PG 14
215215
```sql
216216
CREATE EXTENSION age;
217217
```
218+
219+
220+
221+
222+
## Usage
223+
224+
> [age: AGE graph database extension](https://github.com/apache/age)
225+
226+
Apache AGE brings graph database capabilities to PostgreSQL using the openCypher query language. It enables hybrid querying that combines SQL and Cypher, property indexes on vertices and edges, and the ability to query multiple graphs.
227+
228+
Each session requires loading the extension:
229+
230+
```sql
231+
CREATE EXTENSION age;
232+
LOAD 'age';
233+
SET search_path = ag_catalog, "$user", public;
234+
```
235+
236+
### Graph Operations
237+
238+
Create a graph:
239+
240+
```sql
241+
SELECT create_graph('my_graph');
242+
```
243+
244+
Create vertices:
245+
246+
```sql
247+
SELECT * FROM cypher('my_graph', $$
248+
CREATE (:Person {name: 'Alice', age: 30})
249+
$$) AS (v agtype);
250+
251+
SELECT * FROM cypher('my_graph', $$
252+
CREATE (:Person {name: 'Bob', age: 25})
253+
$$) AS (v agtype);
254+
```
255+
256+
Create edges:
257+
258+
```sql
259+
SELECT * FROM cypher('my_graph', $$
260+
MATCH (a:Person), (b:Person)
261+
WHERE a.name = 'Alice' AND b.name = 'Bob'
262+
CREATE (a)-[e:KNOWS {since: 2020}]->(b)
263+
RETURN e
264+
$$) AS (e agtype);
265+
```
266+
267+
Query the graph:
268+
269+
```sql
270+
SELECT * FROM cypher('my_graph', $$
271+
MATCH (v)-[r]-(v2)
272+
RETURN v, r, v2
273+
$$) AS (v agtype, r agtype, v2 agtype);
274+
```
275+
276+
### Cypher Query Features
277+
278+
AGE supports standard Cypher clauses including `MATCH`, `CREATE`, `SET`, `DELETE`, `RETURN`, `WITH`, `WHERE`, `ORDER BY`, `SKIP`, and `LIMIT`. Data is stored using the `agtype` data type, which extends JSON with graph-specific types for vertices, edges, and paths.
279+
280+
Pattern matching with variable-length paths:
281+
282+
```sql
283+
SELECT * FROM cypher('my_graph', $$
284+
MATCH (a:Person)-[:KNOWS*1..3]->(b:Person)
285+
RETURN a.name, b.name
286+
$$) AS (source agtype, target agtype);
287+
```
288+
289+
Hybrid SQL/Cypher queries allow joining graph results with relational tables:
290+
291+
```sql
292+
SELECT t.*, c.* FROM my_table t
293+
JOIN cypher('my_graph', $$
294+
MATCH (n:Person) RETURN n.name, id(n)
295+
$$) AS c(name agtype, id agtype)
296+
ON t.graph_id = c.id;
297+
```

0 commit comments

Comments
 (0)