From bd89496581e808b7ee9aeed87e9270016f79d7c6 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Tue, 15 Jul 2025 18:23:37 -0500 Subject: [PATCH 1/2] fix: remove unnecessary not null from queue table --- README.md | 4 ++-- sql/pg_net.sql | 2 +- test/test_http_get_collect.py | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a73c501..f565168 100644 --- a/README.md +++ b/README.md @@ -64,8 +64,8 @@ The extension introduces a new `net` schema, which contains two unlogged tables, id bigint NOT NULL DEFAULT nextval('net.http_request_queue_id_seq'::regclass), method text NOT NULL, url text NOT NULL, - headers jsonb NOT NULL, - body bytea NULL, + headers jsonb, + body bytea, timeout_milliseconds integer NOT NULL ) ``` diff --git a/sql/pg_net.sql b/sql/pg_net.sql index 8ab3b32..09d6bc7 100644 --- a/sql/pg_net.sql +++ b/sql/pg_net.sql @@ -13,7 +13,7 @@ create unlogged table net.http_request_queue( id bigserial, method net.http_method not null, url text not null, - headers jsonb not null, + headers jsonb, body bytea, timeout_milliseconds int not null ); diff --git a/test/test_http_get_collect.py b/test/test_http_get_collect.py index a3cee2e..3f3ab38 100644 --- a/test/test_http_get_collect.py +++ b/test/test_http_get_collect.py @@ -174,3 +174,27 @@ def test_http_get_ipv6(sess): assert response is not None assert "Hello ipv6 only" in response[2] + + +def test_http_get_null_headers(sess): + """net.http_get can have null headers""" + + (request_id,) = sess.execute(text( + """ + select net.http_get('http://localhost:8080', null::jsonb, null::jsonb, 100); + """ + )).fetchone() + + sess.commit() + + response = sess.execute( + text( + """ + select * from net._http_collect_response(:request_id, async:=false); + """ + ), + {"request_id": request_id}, + ).fetchone() + + assert response is not None + assert "Hello world" in response[2] From 64ed16f7ad26f21515969e3be318421a969ae4f1 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Tue, 15 Jul 2025 18:31:28 -0500 Subject: [PATCH 2/2] bump to 0.19.3 --- Makefile | 2 +- sql/pg_net--0.19.2--0.19.3.sql | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 sql/pg_net--0.19.2--0.19.3.sql diff --git a/Makefile b/Makefile index f827cd2..5d96c5c 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ else endif EXTENSION = pg_net -EXTVERSION = 0.19.2 +EXTVERSION = 0.19.3 DATA = $(wildcard sql/*--*.sql) diff --git a/sql/pg_net--0.19.2--0.19.3.sql b/sql/pg_net--0.19.2--0.19.3.sql new file mode 100644 index 0000000..f46b6d9 --- /dev/null +++ b/sql/pg_net--0.19.2--0.19.3.sql @@ -0,0 +1,2 @@ +ALTER TABLE net.http_request_queue +ALTER COLUMN headers DROP NOT NULL;