v14-0005-Use-latest-protocol-version-in-libpq_pipeline-te.patch

application/octet-stream

Filename: v14-0005-Use-latest-protocol-version-in-libpq_pipeline-te.patch
Type: application/octet-stream
Part: 3
Message: Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v14-0005
Subject: Use latest protocol version in libpq_pipeline tests
File+
src/test/modules/libpq_pipeline/libpq_pipeline.c 12 3
From 6ac495c2ec09b3802ce2ba6ae2f698d7f904132b Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <jelte.fennema@microsoft.com>
Date: Mon, 3 Jun 2024 19:58:20 +0200
Subject: [PATCH v14 5/9] Use latest protocol version in libpq_pipeline tests

To be able to test new protocol features added by future commits, we
start requesting the latest protocol version in our libpq_pipeline test.
---
 src/test/modules/libpq_pipeline/libpq_pipeline.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/test/modules/libpq_pipeline/libpq_pipeline.c b/src/test/modules/libpq_pipeline/libpq_pipeline.c
index ac4d26302cc..f93778b92f5 100644
--- a/src/test/modules/libpq_pipeline/libpq_pipeline.c
+++ b/src/test/modules/libpq_pipeline/libpq_pipeline.c
@@ -2165,7 +2165,6 @@ print_test_list(void)
 int
 main(int argc, char **argv)
 {
-	const char *conninfo = "";
 	PGconn	   *conn;
 	FILE	   *trace;
 	char	   *testname;
@@ -2173,6 +2172,13 @@ main(int argc, char **argv)
 	PGresult   *res;
 	int			c;
 
+	/*
+	 * dbname = "" because we use expand_dbname, so it's a no-op unless the
+	 * user provides something else
+	 */
+	char	   *conn_keywords[3] = {"dbname", "max_protocol_version"};
+	char	   *conn_values[3] = {"", "latest"};
+
 	while ((c = getopt(argc, argv, "r:t:")) != -1)
 	{
 		switch (c)
@@ -2210,14 +2216,17 @@ main(int argc, char **argv)
 		exit(0);
 	}
 
+	/* We use expand_dbname to parse the user-provided conninfo string */
 	if (optind < argc)
 	{
-		conninfo = pg_strdup(argv[optind]);
+		conn_values[0] = pg_strdup(argv[optind]);
 		optind++;
 	}
 
 	/* Make a connection to the database */
-	conn = PQconnectdb(conninfo);
+	conn = PQconnectdbParams((const char *const *) &conn_keywords,
+							 (const char *const *) &conn_values,
+							 1);
 	if (PQstatus(conn) != CONNECTION_OK)
 	{
 		fprintf(stderr, "Connection to database failed: %s\n",
-- 
2.34.1