agora inbox for [email protected]
help / color / mirror / Atom feed[PATCH v2] contrib/sslinfo: Add ssl_group_info
63+ messages / 2 participants
[nested] [flat]
* [PATCH v2] contrib/sslinfo: Add ssl_group_info
@ 2026-02-19 15:33 Dmitrii Dolgov <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Dmitrii Dolgov @ 2026-02-19 15:33 UTC (permalink / raw)
Add a new function to sslinfo ssl_group_info to show SSL groups,
including negotiated, supported and shared. It's useful for diagnostic
purposes, to identify what's being used and supported, e.g. which key
share is being negotiated. Few examples, for openssl 3.2.4:
select * from ssl_group_info();
type | name
------------+--------------------
negotiated | X25519MLKEM768
shared | X25519MLKEM768
shared | x25519
supported | X25519MLKEM768
supported | x25519
[...]
The implementation is inspired by ssl_print_groups from openssl.
---
contrib/sslinfo/Makefile | 2 +-
contrib/sslinfo/meson.build | 2 +-
contrib/sslinfo/sslinfo--1.2--1.3.sql | 10 ++
contrib/sslinfo/sslinfo.c | 167 +++++++++++++++++++++++++-
contrib/sslinfo/sslinfo.control | 2 +-
doc/src/sgml/sslinfo.sgml | 17 +++
src/tools/pgindent/typedefs.list | 1 +
7 files changed, 197 insertions(+), 4 deletions(-)
create mode 100644 contrib/sslinfo/sslinfo--1.2--1.3.sql
diff --git a/contrib/sslinfo/Makefile b/contrib/sslinfo/Makefile
index 14305594e2d..dc837209c93 100644
--- a/contrib/sslinfo/Makefile
+++ b/contrib/sslinfo/Makefile
@@ -6,7 +6,7 @@ OBJS = \
sslinfo.o
EXTENSION = sslinfo
-DATA = sslinfo--1.2.sql sslinfo--1.1--1.2.sql sslinfo--1.0--1.1.sql
+DATA = sslinfo--1.2--1.3.sql sslinfo--1.1--1.2.sql sslinfo--1.0--1.1.sql
PGFILEDESC = "sslinfo - information about client SSL certificate"
ifdef USE_PGXS
diff --git a/contrib/sslinfo/meson.build b/contrib/sslinfo/meson.build
index 6e9cb96430a..29c7da44228 100644
--- a/contrib/sslinfo/meson.build
+++ b/contrib/sslinfo/meson.build
@@ -25,7 +25,7 @@ contrib_targets += sslinfo
install_data(
'sslinfo--1.0--1.1.sql',
'sslinfo--1.1--1.2.sql',
- 'sslinfo--1.2.sql',
+ 'sslinfo--1.2--1.3.sql',
'sslinfo.control',
kwargs: contrib_data_args,
)
diff --git a/contrib/sslinfo/sslinfo--1.2--1.3.sql b/contrib/sslinfo/sslinfo--1.2--1.3.sql
new file mode 100644
index 00000000000..40fd0ea2b9c
--- /dev/null
+++ b/contrib/sslinfo/sslinfo--1.2--1.3.sql
@@ -0,0 +1,10 @@
+/* contrib/sslinfo/sslinfo--1.2--1.3.sql */
+
+-- complain if script is sourced in psql, rather than via ALTER EXTENSION
+\echo Use "ALTER EXTENSION sslinfo UPDATE TO '1.3'" to load this file. \quit
+
+CREATE FUNCTION
+ssl_group_info(OUT group_type text, OUT name text
+) RETURNS SETOF record
+AS 'MODULE_PATHNAME', 'ssl_group_info'
+LANGUAGE C STRICT PARALLEL RESTRICTED;
diff --git a/contrib/sslinfo/sslinfo.c b/contrib/sslinfo/sslinfo.c
index 2b9eb90b093..e018010d4be 100644
--- a/contrib/sslinfo/sslinfo.c
+++ b/contrib/sslinfo/sslinfo.c
@@ -28,13 +28,28 @@ static Datum X509_NAME_field_to_text(X509_NAME *name, text *fieldName);
static Datum ASN1_STRING_to_text(ASN1_STRING *str);
/*
- * Function context for data persisting over repeated calls.
+ * Function context for data persisting over repeated calls of
+ * ssl_extension_info.
*/
typedef struct
{
TupleDesc tupdesc;
} SSLExtensionInfoContext;
+/*
+ * Function context for data persisting over repeated calls of
+ * ssl_group_info.
+ */
+typedef struct
+{
+ TupleDesc tupdesc;
+ int nshared;
+ int nsupported;
+
+ /* Supported groups have to be stored separately */
+ int *supported_groups;
+} SSLGroupInfoContext;
+
/*
* Indicates whether current session uses SSL
*
@@ -474,3 +489,153 @@ ssl_extension_info(PG_FUNCTION_ARGS)
/* All done */
SRF_RETURN_DONE(funcctx);
}
+
+/*
+ * Returns information about TLS groups.
+ *
+ * Returns setof record made of the following values:
+ * - type of the group: negotiated, shared, supported.
+ * - name of the group.
+ */
+PG_FUNCTION_INFO_V1(ssl_group_info);
+Datum
+ssl_group_info(PG_FUNCTION_ARGS)
+{
+ SSL *ssl = MyProcPort->ssl;
+ FuncCallContext *funcctx;
+ int call_cntr = 0;
+ int max_calls = 0;
+ MemoryContext oldcontext;
+ SSLGroupInfoContext *fctx;
+
+ if (SRF_IS_FIRSTCALL())
+ {
+
+ TupleDesc tupdesc;
+
+ /* create a function context for cross-call persistence */
+ funcctx = SRF_FIRSTCALL_INIT();
+
+ /*
+ * Switch to memory context appropriate for multiple function calls
+ */
+ oldcontext = MemoryContextSwitchTo(funcctx->multi_call_memory_ctx);
+
+ /* Create a user function context for cross-call persistence */
+ fctx = palloc_object(SSLGroupInfoContext);
+
+ /* Construct tuple descriptor */
+ if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("function returning record called in context that cannot accept type record")));
+ fctx->tupdesc = BlessTupleDesc(tupdesc);
+
+ if (!MyProcPort->ssl_in_use)
+ {
+ /* fast track when no results */
+ MemoryContextSwitchTo(oldcontext);
+ SRF_RETURN_DONE(funcctx);
+ }
+
+ if (ssl != NULL)
+ {
+ fctx->nsupported = SSL_get1_groups(ssl, NULL);
+ fctx->nshared = SSL_get_shared_group(ssl, -1);
+
+ fctx->supported_groups =
+ palloc(fctx->nsupported * sizeof(*fctx->supported_groups));
+ SSL_get1_groups(ssl, fctx->supported_groups);
+
+ /*
+ * Set max_calls as the number of supported groups plus the number
+ * of shared groups plus one negotiated group.
+ */
+ max_calls = fctx->nsupported + fctx->nshared + 1;
+ }
+
+ if (max_calls > 0)
+ {
+ /* got results, keep track of them */
+ funcctx->max_calls = max_calls;
+ funcctx->user_fctx = fctx;
+ }
+ else
+ {
+ /* fast track when no results */
+ MemoryContextSwitchTo(oldcontext);
+ SRF_RETURN_DONE(funcctx);
+ }
+
+ MemoryContextSwitchTo(oldcontext);
+ }
+
+ /* stuff done on every call of the function */
+ funcctx = SRF_PERCALL_SETUP();
+
+ /*
+ * Initialize per-call variables.
+ */
+ call_cntr = funcctx->call_cntr;
+ max_calls = funcctx->max_calls;
+ fctx = funcctx->user_fctx;
+
+ /* do while there are more left to send */
+ if (call_cntr < max_calls)
+ {
+ Datum values[2];
+ bool nulls[2];
+ HeapTuple tuple;
+ Datum result,
+ group_type;
+ int nid;
+ const char *group_name;
+
+ /* Send the negotiated group first */
+ if (call_cntr == 0)
+ {
+ nid = SSL_get_negotiated_group(ssl);
+ group_type = CStringGetTextDatum("negotiated");
+ }
+ /* Then the shared groups */
+ else if (call_cntr < fctx->nshared + 1)
+ {
+ nid = SSL_get_shared_group(ssl, call_cntr - 1);
+ group_type = CStringGetTextDatum("shared");
+ }
+ /* And finally the supported groups */
+ else if (call_cntr < fctx->nsupported + fctx->nshared + 1)
+ {
+ nid = fctx->supported_groups[call_cntr - fctx->nshared - 1];
+ group_type = CStringGetTextDatum("supported");
+ }
+ else
+ SRF_RETURN_DONE(funcctx);
+
+ /*
+ * SSL_group_to_name can return NULL in case of an error, e.g. when no
+ * such name was registered for some reason.
+ */
+ group_name = SSL_group_to_name(ssl, nid);
+ if (group_name == NULL)
+ ereport(ERROR,
+ (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+ errmsg("unknown OpenSSL group at position %d",
+ call_cntr)));
+
+ values[0] = group_type;
+ nulls[0] = false;
+
+ values[1] = CStringGetTextDatum(group_name);
+ nulls[1] = false;
+
+ /* Build tuple */
+ tuple = heap_form_tuple(fctx->tupdesc, values, nulls);
+ result = HeapTupleGetDatum(tuple);
+
+ SRF_RETURN_NEXT(funcctx, result);
+ }
+
+ /* All done */
+ SRF_RETURN_DONE(funcctx);
+}
diff --git a/contrib/sslinfo/sslinfo.control b/contrib/sslinfo/sslinfo.control
index c7754f924cf..b53e95b7da8 100644
--- a/contrib/sslinfo/sslinfo.control
+++ b/contrib/sslinfo/sslinfo.control
@@ -1,5 +1,5 @@
# sslinfo extension
comment = 'information about SSL certificates'
-default_version = '1.2'
+default_version = '1.3'
module_pathname = '$libdir/sslinfo'
relocatable = true
diff --git a/doc/src/sgml/sslinfo.sgml b/doc/src/sgml/sslinfo.sgml
index 85d49f66537..8ba2302fe08 100644
--- a/doc/src/sgml/sslinfo.sgml
+++ b/doc/src/sgml/sslinfo.sgml
@@ -240,6 +240,23 @@ emailAddress
</para>
</listitem>
</varlistentry>
+
+ <varlistentry>
+ <term>
+ <function>ssl_group_info() returns setof record</function>
+ <indexterm>
+ <primary>ssl_group_info</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Provide information about TLS groups: group type and group name.
+ The group type value could be one of the following: negotiated
+ (the group used for the handshake key exchange process), shared
+ or supported. The latter two are used mostly for diagnostic purposes.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</sect2>
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index 241945734ec..74eb3043dbb 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -2694,6 +2694,7 @@ SQLValueFunction
SQLValueFunctionOp
SSL
SSLExtensionInfoContext
+SSLGroupInfoContext
SSL_CTX
STARTUPINFO
STRLEN
base-commit: 5b93a5987bd704d2363295eee919eee45f84c286
--
2.52.0
--bjvr4kzjz3vjgd5w--
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
* [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition
@ 2026-07-01 10:31 Jonathan Gonzalez V. <[email protected]>
0 siblings, 0 replies; 63+ messages in thread
From: Jonathan Gonzalez V. @ 2026-07-01 10:31 UTC (permalink / raw)
There was three separated definition of the function making lcov v2.x fail
with an error.
---
src/interfaces/libpq/fe-auth-oauth.c | 61 +++++++++++-----------------
1 file changed, 24 insertions(+), 37 deletions(-)
diff --git a/src/interfaces/libpq/fe-auth-oauth.c b/src/interfaces/libpq/fe-auth-oauth.c
index 826f7461cb3..7a35647feb8 100644
--- a/src/interfaces/libpq/fe-auth-oauth.c
+++ b/src/interfaces/libpq/fe-auth-oauth.c
@@ -833,41 +833,42 @@ cleanup_oauth_flow(PGconn *conn)
* failure, and positive indicates success.
*/
-#if !defined(USE_LIBCURL)
+#if defined(USE_LIBCURL) && defined(USE_DYNAMIC_OAUTH)
/*
- * This configuration doesn't support the builtin flow.
+ * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
*/
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
- return 0;
-}
+typedef char *(*libpq_gettext_func) (const char *msgid);
-#elif defined(USE_DYNAMIC_OAUTH)
+#elif defined(USE_LIBCURL)
/*
- * Use the builtin flow in the libpq-oauth plugin, which is loaded at runtime.
+ * For static builds, we can just call pg_start_oauthbearer() directly. It's
+ * provided by libpq-oauth.a.
*/
+extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-typedef char *(*libpq_gettext_func) (const char *msgid);
+#endif
-/*
- * Loads the libpq-oauth plugin via dlopen(), initializes it, and plugs its
- * callbacks into the connection's async auth handlers.
- *
- * Failure to load here results in a relatively quiet connection error, to
- * handle the use case where the build supports loading a flow but a user does
- * not want to install it. Troubleshooting of linker/loader failures can be done
- * via PGOAUTHDEBUG.
- *
- * The lifetime of *request ends shortly after this call, so it must be copied
- * to longer-lived storage.
- */
static int
use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
{
+#if !defined(USE_LIBCURL)
+ return 0;
+#elif defined(USE_DYNAMIC_OAUTH)
+ /*
+ * Load the libpq-oauth plugin via dlopen(), initialize it, and plug its
+ * callbacks into the connection's async auth handlers.
+ *
+ * Failure to load here results in a relatively quiet connection error, to
+ * handle the use case where the build supports loading a flow but a user
+ * does not want to install it. Troubleshooting of linker/loader failures
+ * can be done via PGOAUTHDEBUG.
+ *
+ * The lifetime of *request ends shortly after this call, so it must be
+ * copied to longer-lived storage.
+ */
static bool initialized = false;
static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER;
int lockerr;
@@ -976,24 +977,10 @@ use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *re
}
return (start_flow(conn, request) == 0) ? 1 : -1;
-}
-
#else
-
-/*
- * For static builds, we can just call pg_start_oauthbearer() directly. It's
- * provided by libpq-oauth.a.
- */
-
-extern int pg_start_oauthbearer(PGconn *conn, PGoauthBearerRequestV2 *request);
-
-static int
-use_builtin_flow(PGconn *conn, fe_oauth_state *state, PGoauthBearerRequestV2 *request)
-{
return (pg_start_oauthbearer(conn, request) == 0) ? 1 : -1;
-}
-
#endif /* USE_LIBCURL */
+}
/*
--
2.53.0
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=v1-0002-Collapse-SH_CREATE-into-a-single-definition.patch
^ permalink raw reply [nested|flat] 63+ messages in thread
end of thread, other threads:[~2026-07-01 10:31 UTC | newest]
Thread overview: 63+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19 15:33 [PATCH v2] contrib/sslinfo: Add ssl_group_info Dmitrii Dolgov <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
2026-07-01 10:31 [PATCH v1 1/2] libpq-oauth: collapse use_builtin_flow() into a single definition Jonathan Gonzalez V. <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox