http

HTTP client for PostgreSQL, allows web page retrieval inside the database.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
4070
http
pg_http
1.7.0
UTIL
MIT
C
AttributeHas BinaryHas LibraryNeed LoadHas DDLRelocatableTrusted
--s-d--
No
Yes
No
Yes
no
no
Relationships
See Also
pg_net
pg_curl
pgjwt
pg_smtp_client
gzip
bzip
zstd
pgjq

Packages

TypeRepoVersionPG Major AvailabilityPackage PatternDependencies
EL
PGDG
1.7.0
18
17
16
15
14
13
pg_http_$v*-
Debian
PGDG
1.7.0
18
17
16
15
14
13
postgresql-$v-http-
Linux / PGPG18PG17PG16PG15PG14PG13
el8.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
el8.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
el9.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
el9.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
el10.x86_64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
el10.aarch64
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
PIGSTY 1.7.0
d12.x86_64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
d12.aarch64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
d13.x86_64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
d13.aarch64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
u22.x86_64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
u22.aarch64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
u24.x86_64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
u24.aarch64
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PGDG 1.7.0
PackageVersionOSORGSIZEFile URL
pg_http_181.7.0el8.x86_64pigsty29.0 KiBpg_http_18-1.7.0-1PIGSTY.el8.x86_64.rpm
pg_http_181.7.0el8.aarch64pigsty28.3 KiBpg_http_18-1.7.0-1PIGSTY.el8.aarch64.rpm
pg_http_181.7.0el9.x86_64pigsty29.1 KiBpg_http_18-1.7.0-1PIGSTY.el9.x86_64.rpm
pg_http_181.7.0el9.aarch64pigsty28.0 KiBpg_http_18-1.7.0-1PIGSTY.el9.aarch64.rpm
pg_http_181.7.0el10.x86_64pigsty29.5 KiBpg_http_18-1.7.0-1PIGSTY.el10.x86_64.rpm
pg_http_181.7.0el10.aarch64pigsty28.2 KiBpg_http_18-1.7.0-1PIGSTY.el10.aarch64.rpm
postgresql-18-http1.7.0d12.x86_64pgdg44.5 KiBpostgresql-18-http_1.7.0-3.pgdg12+1_amd64.deb
postgresql-18-http1.7.0d12.aarch64pgdg43.1 KiBpostgresql-18-http_1.7.0-3.pgdg12+1_arm64.deb
postgresql-18-http1.7.0d13.x86_64pgdg44.6 KiBpostgresql-18-http_1.7.0-3.pgdg13+1_amd64.deb
postgresql-18-http1.7.0d13.aarch64pgdg43.2 KiBpostgresql-18-http_1.7.0-3.pgdg13+1_arm64.deb
postgresql-18-http1.7.0u22.x86_64pgdg44.7 KiBpostgresql-18-http_1.7.0-3.pgdg22.04+1_amd64.deb
postgresql-18-http1.7.0u22.aarch64pgdg43.1 KiBpostgresql-18-http_1.7.0-3.pgdg22.04+1_arm64.deb
postgresql-18-http1.7.0u24.x86_64pgdg44.5 KiBpostgresql-18-http_1.7.0-3.pgdg24.04+1_amd64.deb
postgresql-18-http1.7.0u24.aarch64pgdg43.0 KiBpostgresql-18-http_1.7.0-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_http_171.7.0el8.x86_64pigsty29.1 KiBpg_http_17-1.7.0-1PIGSTY.el8.x86_64.rpm
pg_http_171.7.0el8.aarch64pigsty28.3 KiBpg_http_17-1.7.0-1PIGSTY.el8.aarch64.rpm
pg_http_171.7.0el9.x86_64pigsty29.2 KiBpg_http_17-1.7.0-1PIGSTY.el9.x86_64.rpm
pg_http_171.7.0el9.aarch64pigsty28.1 KiBpg_http_17-1.7.0-1PIGSTY.el9.aarch64.rpm
pg_http_171.7.0el10.x86_64pigsty29.5 KiBpg_http_17-1.7.0-1PIGSTY.el10.x86_64.rpm
pg_http_171.7.0el10.aarch64pigsty28.4 KiBpg_http_17-1.7.0-1PIGSTY.el10.aarch64.rpm
postgresql-17-http1.7.0d12.x86_64pgdg44.6 KiBpostgresql-17-http_1.7.0-3.pgdg12+1_amd64.deb
postgresql-17-http1.7.0d12.aarch64pgdg43.1 KiBpostgresql-17-http_1.7.0-3.pgdg12+1_arm64.deb
postgresql-17-http1.7.0d13.x86_64pgdg44.6 KiBpostgresql-17-http_1.7.0-3.pgdg13+1_amd64.deb
postgresql-17-http1.7.0d13.aarch64pgdg43.3 KiBpostgresql-17-http_1.7.0-3.pgdg13+1_arm64.deb
postgresql-17-http1.7.0u22.x86_64pgdg48.9 KiBpostgresql-17-http_1.7.0-3.pgdg22.04+1_amd64.deb
postgresql-17-http1.7.0u22.aarch64pgdg47.4 KiBpostgresql-17-http_1.7.0-3.pgdg22.04+1_arm64.deb
postgresql-17-http1.7.0u24.x86_64pgdg44.6 KiBpostgresql-17-http_1.7.0-3.pgdg24.04+1_amd64.deb
postgresql-17-http1.7.0u24.aarch64pgdg43.2 KiBpostgresql-17-http_1.7.0-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_http_161.7.0el8.x86_64pigsty29.1 KiBpg_http_16-1.7.0-1PIGSTY.el8.x86_64.rpm
pg_http_161.7.0el8.aarch64pigsty28.3 KiBpg_http_16-1.7.0-1PIGSTY.el8.aarch64.rpm
pg_http_161.7.0el9.x86_64pigsty29.2 KiBpg_http_16-1.7.0-1PIGSTY.el9.x86_64.rpm
pg_http_161.7.0el9.aarch64pigsty28.1 KiBpg_http_16-1.7.0-1PIGSTY.el9.aarch64.rpm
pg_http_161.7.0el10.x86_64pigsty29.5 KiBpg_http_16-1.7.0-1PIGSTY.el10.x86_64.rpm
pg_http_161.7.0el10.aarch64pigsty28.4 KiBpg_http_16-1.7.0-1PIGSTY.el10.aarch64.rpm
postgresql-16-http1.7.0d12.x86_64pgdg44.5 KiBpostgresql-16-http_1.7.0-3.pgdg12+1_amd64.deb
postgresql-16-http1.7.0d12.aarch64pgdg43.1 KiBpostgresql-16-http_1.7.0-3.pgdg12+1_arm64.deb
postgresql-16-http1.7.0d13.x86_64pgdg44.6 KiBpostgresql-16-http_1.7.0-3.pgdg13+1_amd64.deb
postgresql-16-http1.7.0d13.aarch64pgdg43.3 KiBpostgresql-16-http_1.7.0-3.pgdg13+1_arm64.deb
postgresql-16-http1.7.0u22.x86_64pgdg48.9 KiBpostgresql-16-http_1.7.0-3.pgdg22.04+1_amd64.deb
postgresql-16-http1.7.0u22.aarch64pgdg47.3 KiBpostgresql-16-http_1.7.0-3.pgdg22.04+1_arm64.deb
postgresql-16-http1.7.0u24.x86_64pgdg44.6 KiBpostgresql-16-http_1.7.0-3.pgdg24.04+1_amd64.deb
postgresql-16-http1.7.0u24.aarch64pgdg43.2 KiBpostgresql-16-http_1.7.0-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_http_151.7.0el8.x86_64pigsty29.4 KiBpg_http_15-1.7.0-1PIGSTY.el8.x86_64.rpm
pg_http_151.7.0el8.aarch64pigsty28.6 KiBpg_http_15-1.7.0-1PIGSTY.el8.aarch64.rpm
pg_http_151.7.0el9.x86_64pigsty29.5 KiBpg_http_15-1.7.0-1PIGSTY.el9.x86_64.rpm
pg_http_151.7.0el9.aarch64pigsty28.4 KiBpg_http_15-1.7.0-1PIGSTY.el9.aarch64.rpm
pg_http_151.7.0el10.x86_64pigsty29.9 KiBpg_http_15-1.7.0-1PIGSTY.el10.x86_64.rpm
pg_http_151.7.0el10.aarch64pigsty28.7 KiBpg_http_15-1.7.0-1PIGSTY.el10.aarch64.rpm
postgresql-15-http1.7.0d12.x86_64pgdg45.4 KiBpostgresql-15-http_1.7.0-3.pgdg12+1_amd64.deb
postgresql-15-http1.7.0d12.aarch64pgdg44.1 KiBpostgresql-15-http_1.7.0-3.pgdg12+1_arm64.deb
postgresql-15-http1.7.0d13.x86_64pgdg45.7 KiBpostgresql-15-http_1.7.0-3.pgdg13+1_amd64.deb
postgresql-15-http1.7.0d13.aarch64pgdg44.1 KiBpostgresql-15-http_1.7.0-3.pgdg13+1_arm64.deb
postgresql-15-http1.7.0u22.x86_64pgdg50.0 KiBpostgresql-15-http_1.7.0-3.pgdg22.04+1_amd64.deb
postgresql-15-http1.7.0u22.aarch64pgdg48.1 KiBpostgresql-15-http_1.7.0-3.pgdg22.04+1_arm64.deb
postgresql-15-http1.7.0u24.x86_64pgdg45.5 KiBpostgresql-15-http_1.7.0-3.pgdg24.04+1_amd64.deb
postgresql-15-http1.7.0u24.aarch64pgdg44.1 KiBpostgresql-15-http_1.7.0-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_http_141.7.0el8.x86_64pigsty29.4 KiBpg_http_14-1.7.0-1PIGSTY.el8.x86_64.rpm
pg_http_141.7.0el8.aarch64pigsty28.6 KiBpg_http_14-1.7.0-1PIGSTY.el8.aarch64.rpm
pg_http_141.7.0el9.x86_64pigsty29.5 KiBpg_http_14-1.7.0-1PIGSTY.el9.x86_64.rpm
pg_http_141.7.0el9.aarch64pigsty28.4 KiBpg_http_14-1.7.0-1PIGSTY.el9.aarch64.rpm
pg_http_141.7.0el10.x86_64pigsty29.9 KiBpg_http_14-1.7.0-1PIGSTY.el10.x86_64.rpm
pg_http_141.7.0el10.aarch64pigsty28.7 KiBpg_http_14-1.7.0-1PIGSTY.el10.aarch64.rpm
postgresql-14-http1.7.0d12.x86_64pgdg45.3 KiBpostgresql-14-http_1.7.0-3.pgdg12+1_amd64.deb
postgresql-14-http1.7.0d12.aarch64pgdg44.0 KiBpostgresql-14-http_1.7.0-3.pgdg12+1_arm64.deb
postgresql-14-http1.7.0d13.x86_64pgdg45.6 KiBpostgresql-14-http_1.7.0-3.pgdg13+1_amd64.deb
postgresql-14-http1.7.0d13.aarch64pgdg44.1 KiBpostgresql-14-http_1.7.0-3.pgdg13+1_arm64.deb
postgresql-14-http1.7.0u22.x86_64pgdg50.0 KiBpostgresql-14-http_1.7.0-3.pgdg22.04+1_amd64.deb
postgresql-14-http1.7.0u22.aarch64pgdg48.1 KiBpostgresql-14-http_1.7.0-3.pgdg22.04+1_arm64.deb
postgresql-14-http1.7.0u24.x86_64pgdg45.6 KiBpostgresql-14-http_1.7.0-3.pgdg24.04+1_amd64.deb
postgresql-14-http1.7.0u24.aarch64pgdg44.1 KiBpostgresql-14-http_1.7.0-3.pgdg24.04+1_arm64.deb
PackageVersionOSORGSIZEFile URL
pg_http_131.7.0el8.x86_64pigsty28.9 KiBpg_http_13-1.7.0-1PIGSTY.el8.x86_64.rpm
pg_http_131.7.0el8.aarch64pigsty28.5 KiBpg_http_13-1.7.0-1PIGSTY.el8.aarch64.rpm
pg_http_131.7.0el9.x86_64pigsty29.4 KiBpg_http_13-1.7.0-1PIGSTY.el9.x86_64.rpm
pg_http_131.7.0el9.aarch64pigsty28.7 KiBpg_http_13-1.7.0-1PIGSTY.el9.aarch64.rpm
pg_http_131.7.0el10.x86_64pigsty29.7 KiBpg_http_13-1.7.0-1PIGSTY.el10.x86_64.rpm
pg_http_131.7.0el10.aarch64pigsty28.6 KiBpg_http_13-1.7.0-1PIGSTY.el10.aarch64.rpm
postgresql-13-http1.7.0d12.x86_64pgdg45.3 KiBpostgresql-13-http_1.7.0-3.pgdg12+1_amd64.deb
postgresql-13-http1.7.0d12.aarch64pgdg43.9 KiBpostgresql-13-http_1.7.0-3.pgdg12+1_arm64.deb
postgresql-13-http1.7.0d13.x86_64pgdg45.5 KiBpostgresql-13-http_1.7.0-3.pgdg13+1_amd64.deb
postgresql-13-http1.7.0d13.aarch64pgdg43.8 KiBpostgresql-13-http_1.7.0-3.pgdg13+1_arm64.deb
postgresql-13-http1.7.0u22.x86_64pgdg49.6 KiBpostgresql-13-http_1.7.0-3.pgdg22.04+1_amd64.deb
postgresql-13-http1.7.0u22.aarch64pgdg48.3 KiBpostgresql-13-http_1.7.0-3.pgdg22.04+1_arm64.deb
postgresql-13-http1.7.0u24.x86_64pgdg45.4 KiBpostgresql-13-http_1.7.0-3.pgdg24.04+1_amd64.deb
postgresql-13-http1.7.0u24.aarch64pgdg43.7 KiBpostgresql-13-http_1.7.0-3.pgdg24.04+1_arm64.deb

Source

pig build get http; # get http source code
pig build dep http; # install build dependencies
pig build pkg http; # build extension rpm or deb
pig build ext http; # build extension rpms

Install

To add the required PGDG / PIGSTY upstream repository, use:

pig repo add pgsql -u   # add PGDG + Pigsty repo and update cache (leave existing repos)

Install this extension with:

pig ext install http; # install by extension name, for the current active PG version
pig ext install pg_http; # install via package alias, for the active PG version
pig ext install http -v 18;   # install for PG 18
pig ext install http -v 17;   # install for PG 17
pig ext install http -v 16;   # install for PG 16
pig ext install http -v 15;   # install for PG 15
pig ext install http -v 14;   # install for PG 14
pig ext install http -v 13;   # install for PG 13

Create this extension with:

CREATE EXTENSION http;

Usage

https://github.com/pramsey/pgsql-http

Request / Response Schema:

     Composite type "public.http_request"
    Column    |       Type        | Modifiers
--------------+-------------------+-----------
 method       | http_method       |
 uri          | character varying |
 headers      | http_header[]     |
 content_type | character varying |
 content      | character varying |

    Composite type "public.http_response"
    Column    |       Type        | Modifiers
--------------+-------------------+-----------
 status       | integer           |
 content_type | character varying |
 headers      | http_header[]     |
 content      | character varying |

Examples

Sending HTTP GET requests with SQL

CREATE EXTENSION http;

-- get content
SELECT content FROM http_get('http://httpbun.com/');

-- get status and content_type
SELECT status, content_type FROM http_get('http://httpbun.com/');

--  status |       content_type
-- --------+--------------------------
--     200 | text/html; charset=utf-8

-- get headers
SELECT (unnest(headers)).* FROM http_get('http://httpbun.com/');

--             field           |                      value
--  ---------------------------+--------------------------------------------------
--  Location                  | https://httpbun.com/
--  Date                      | Mon, 04 Nov 2024 09:00:36 GMT
--  Content-Length            | 0
--  Connection                | close
--  alt-svc                   | h3=":443"; ma=2592000
--  content-security-policy   | frame-ancestors 'none'
--  content-type              | text/html
--  date                      | Mon, 04 Nov 2024 09:00:37 GMT
--  strict-transport-security | max-age=31536000; includeSubDomains; preload
--  x-content-type-options    | nosniff
--  x-powered-by              | httpbun/af040d24038613575a85f74c2283ae79f8169927
--  (11 rows)
SELECT status, content::json->'form' AS form FROM http_post('http://httpbun.com/post', jsonb_build_object('myvar','myval','foo','bar'));

Issue http put requests:

SELECT status, content_type, content::json->>'data' AS data
  FROM http_put('http://httpbun.com/put', 'some text', 'text/plain');


--  status |   content_type   |   data
-- --------+------------------+-----------
--  200 | application/json | some text

Issue http post request:

Last updated on