Skip to content

rpc

Synchronous JSON-to-JSON RPC client for PostgreSQL over a Unix domain socket, with a companion Go server example

rpc · Synchronous JSON-to-JSON RPC client for PostgreSQL over a Unix domain socket, with a companion Go server example

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
101153rpcrpc1.0UTILUnknownC

Usage

Sources:

rpc sends a JSON document to a Unix-domain socket and returns the JSON document sent back by the peer. Each frame is prefixed by a big-endian 32-bit length.

CREATE EXTENSION rpc;
SET rpc.path = '/var/run/postgresql/rpc.sock';
SET rpc.timeout = 5;
SELECT rpc('{"operation":"validate","value":42}'::json);

The default socket is /var/run/postgresql/rpc.sock; both rpc.path and the zero-to-sixty-second rpc.timeout are user-settable. The peer must implement the exact framing protocol and return valid JSON.

Version 1.0 is a small old native client with no authentication, authorization, release history, tests, or compatibility matrix. Any function caller can select another accessible Unix socket. The response length supplied by the peer drives an unchecked memory allocation, so a malicious peer can exhaust a backend. Revoke public execution and setting privileges, constrain filesystem access, and use only with a trusted local service.

Table reader