Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't define get_extension_schema for PG16 and higher. It is already … #156

Merged
merged 1 commit into from
May 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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