pg_net
pg_net : Async HTTP Requests
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4080 | pg_net | pg_net | 0.20.5 |
UTIL | Apache-2.0 | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
| --sLd-- | No | Yes | Yes | Yes | no | no |
| Relationships | |
|---|---|
| Schemas | net |
| See Also | http pg_curl omni_httpc pg_graphql documentdb |
Packages
| Linux / PG | PG19 | PG18 | PG17 | PG16 | PG15 |
|---|---|---|---|---|---|
| el8.x86_64 | N/A | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 |
| el8.aarch64 | N/A | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 |
| el9.x86_64 | MISS | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 |
| el9.aarch64 | MISS | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 |
| el10.x86_64 | PGDG 0.20.5 | PGDG 0.20.5 | PGDG 0.20.5 | PGDG 0.20.5 | PGDG 0.20.5 |
| el10.aarch64 | PGDG 0.20.5 | PGDG 0.20.5 | PGDG 0.20.5 | PGDG 0.20.5 | PGDG 0.20.5 |
| d12.x86_64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| d12.aarch64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| d13.x86_64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| d13.aarch64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| u22.x86_64 | MISS | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 |
| u22.aarch64 | MISS | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 | PIGSTY 0.9.2 |
| u24.x86_64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| u24.aarch64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| u26.x86_64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
| u26.aarch64 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 | PIGSTY 0.20.5 |
Source
github.com/supabase/pg_net
pg_net-0.20.5.tar.gz pg_net-0.9.2.tar.gz
Install
Make sure PGDG and PIGSTY repo available:
Install this extension with pig:
Config this extension to shared_preload_libraries:
Create this extension with:
Usage
Sources:
pg_net queues asynchronous HTTP and HTTPS requests from SQL. It creates the net schema, stores pending work in net.http_request_queue, and stores responses in net._http_response. A background worker uses libcurl to process queued requests.
The extension requires shared_preload_libraries = 'pg_net' and libcurl >= 7.83.
GET Request
net.http_get(url, params, headers, timeout_milliseconds) returns a bigint request id.
POST Request
Send one table row as JSON:
DELETE Request
net.http_delete(url, params, headers, timeout_milliseconds) is SECURITY DEFINER and returns a bigint request id.
Checking Responses
Failed requests can be identified from status_code and error_msg. The response table does not preserve every original request argument, so store request metadata separately if you need retry workflows.
Configuration
pg_net.batch_size, default200, limits how many queued requests the worker processes per cycle.pg_net.ttl, default6 hours, controls response retention.pg_net.database_name, defaultpostgres, selects the database where the worker runs.pg_net.username, default NULL, selects the worker connection user; NULL uses the bootstrap user.
Settings can be changed in postgresql.conf or with ALTER SYSTEM:
Changing pg_net.database_name or pg_net.username requires restarting the worker:
Caveats
- The package matrix carries
pg_net0.20.5 for PostgreSQL 14-18 on EL10 RPM and D12/D13/U24/U26 DEB; EL8, EL9, and U22 remain on 0.9.2 because of olderlibcurl. - Upstream documents PostgreSQL 12+ compatibility, but this catalog row is packaged for PostgreSQL 14-18.
pg_netsupports only one database per cluster throughpg_net.database_name.- v0.20.5 adds PostgreSQL 19 beta 1 compatibility and fixes a macOS worker segfault; no new request API is documented.