Skip to content

Commit

Permalink
Don't define get_extension_schema for PG16 and higher. It is already …
Browse files Browse the repository at this point in the history
…exposed
  • Loading branch information
robe2 committed May 16, 2023
1 parent b30ad61 commit 62fdf17
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions http.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ void _PG_init(void)
NULL);

#ifdef HTTP_MEM_CALLBACKS
/*
* Use PgSQL memory management in Curl
/*
* Use PgSQL memory management in Curl
* Warning, https://curl.se/libcurl/c/curl_global_init_mem.html
* notes "If you are using libcurl from multiple threads or libcurl
* was built with the threaded resolver option then the callback
* notes "If you are using libcurl from multiple threads or libcurl
* was built with the threaded resolver option then the callback
* functions must be thread safe." PgSQL isn't multi-threaded,
* but we have no control over whether the "threaded resolver" is
* in use. We may need a semaphor to ensure our callbacks are
Expand Down Expand Up @@ -598,7 +598,11 @@ header_array_to_slist(ArrayType *array, struct curl_slist *headers)

return headers;
}

/**
* This function is now exposed in PG16 and above
* so no need to redefine it for PG16 and above
*/
#if PG_VERSION_NUM < 160000
/**
* Look up the namespace the extension is installed in
*/
Expand Down Expand Up @@ -638,6 +642,7 @@ get_extension_schema(Oid ext_oid)

return result;
}
#endif

/**
* Look up the tuple description for a extension-defined type,
Expand Down Expand Up @@ -1179,13 +1184,13 @@ Datum http_request(PG_FUNCTION_ARGS)
{
/* Force the verb to be GET */
CURL_SETOPT(g_http_handle, CURLOPT_CUSTOMREQUEST, "GET");
}
else if( method == HTTP_DELETE )
}
else if( method == HTTP_DELETE )
{
/* Force the verb to be DELETE */
CURL_SETOPT(g_http_handle, CURLOPT_CUSTOMREQUEST, "DELETE");
}

CURL_SETOPT(g_http_handle, CURLOPT_POSTFIELDS, text_to_cstring(content_text));
}
else if ( method == HTTP_PUT || method == HTTP_PATCH )
Expand Down

0 comments on commit 62fdf17

Please sign in to comment.