expand pg_net functionality with more operations and other data types
Is your feature request related to a problem? Please describe.
Yes. I would like to use
pg_net to access REST micro-services in an asynchronous manner, when those services rely on other HTTP methods besides just
GET, such as
DELETE. Moreover, sometimes those services work with payloads that are not JSON and therefore cannot be passed to a PostgreSQL function as a
jsonb data type.
Describe the solution you'd like
In addition to the existing
net.http_get(url text, params jsonb, headers jsonb, timeout_milliseconds int) and
net.http_post(url text, params jsonb, headers jsonb, timeout_milliseconds int) functions, I would like for there to be a master function
net.http(request http_request, timeout_milliseconds int) function similar to the
http.http(request http_request) function in the psql-http extension. Like in that extension,
http_request would be a data type that has both a
method and a
content attribute, the latter being
varchar. This would be enough to support other HTTP methods and other payloads.
Describe alternatives you've considered
I have considered and even used the synchronous
http extension in conjunction with custom tables and the
pg_cron extension to (re)implement a pseudo-async processor, but it's cumbersome and duplicative of the work that's in the
No other context is relevant.