Skip to content

pg_http

AlohaDB synchronous plain-HTTP client functions

alohadb · AlohaDB synchronous plain-HTTP client functions

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102463pg_httpalohadb1.0UTILMITC

PostgreSQL · 18

Usage

Sources:

pg_http 1.0 is AlohaDB’s synchronous HTTP client. It is distinct from the http extension distributed as pg_http by pgsql-http; their shared public function names may conflict.

These are preview modules of AlohaDB 21.2.0, a PostgreSQL 18 fork. Compatibility with stock PostgreSQL is not established.

Enable and Call

A superuser installs the extension in the fixed public schema. Requests are disabled by default; the superuser-settable pg_http.enabled must be enabled explicitly. No preload or restart is required.

CREATE EXTENSION pg_http;
SET pg_http.enabled = on;
SELECT status, response_headers, body
FROM http_get('http://127.0.0.1:8080/health', timeout_ms => 1000);

http_get, http_post, http_put, http_delete and http_request return status, JSONB headers and a text body. The default timeout is 30000 ms, capped by pg_http.max_timeout_ms; the administrator may configure the cap from 1000 to 300000 ms. Calls block the backend until completion or error.

Network Boundary

The reviewed raw-socket client supports plain HTTP only and explicitly rejects HTTPS, despite HTTPS URLs in the top-level README. There is no verified URL/destination allowlist. Restrict SQL EXECUTE grants and network egress, use trusted destinations, and avoid placing secrets in cleartext requests. External effects are not rolled back with the SQL transaction; do not treat a trigger call as transactional delivery.

This module was formerly named alohadb_http. Use AlohaDB’s matching files and conversion procedure; it is not a drop-in replacement for pgsql-http.

Table reader