v9-0004-Prepare-server-code-for-addition-of-protocol-exte.patch
application/octet-stream
Filename: v9-0004-Prepare-server-code-for-addition-of-protocol-exte.patch
Type: application/octet-stream
Part: 3
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 v9-0004
Subject: Prepare server code for addition of protocol extensions
| File | + | − |
|---|---|---|
| src/backend/postmaster/postmaster.c | 3 | 4 |
| src/include/utils/guc_tables.h | 1 | 0 |
From 982e0cbe127369e5729285ba8c7537279647ab2c Mon Sep 17 00:00:00 2001
From: Jelte Fennema-Nio <jelte.fennema@microsoft.com>
Date: Fri, 5 Jan 2024 14:45:04 +0100
Subject: [PATCH v9 04/13] Prepare server code for addition of protocol
extensions
This adds some small changes to are necessary to support protocol
extension parameter GUCs in the future.
The server now checks if a GUC with the name of the protocol extension
parameter exists before reporting it as unsupported. The final behaviour
is still the same, since we have no GUCs yet that start with the `_pq_.`
prefix. It also adds a PROTOCOL_EXTENSION variant to the config_group
enum so protocol extension parameters can be grouped together.
---
src/backend/postmaster/postmaster.c | 7 +++----
src/include/utils/guc_tables.h | 1 +
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index df945a5ac4d..034ab73b64f 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -2202,12 +2202,11 @@ retry1:
valptr),
errhint("Valid values are: \"false\", 0, \"true\", 1, \"database\".")));
}
- else if (strncmp(nameptr, "_pq_.", 5) == 0)
+ else if (strncmp(nameptr, "_pq_.", 5) == 0 && !find_option(nameptr, false, true, ERROR))
{
/*
- * Any option beginning with _pq_. is reserved for use as a
- * protocol-level option, but at present no such options are
- * defined.
+ * We report unkown protocol extensions using the
+ * NegotiateProtocolVersion message instead of erroring
*/
unrecognized_protocol_options =
lappend(unrecognized_protocol_options, pstrdup(nameptr));
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h
index 0a2e274ebb2..4bba3dc3ccd 100644
--- a/src/include/utils/guc_tables.h
+++ b/src/include/utils/guc_tables.h
@@ -99,6 +99,7 @@ enum config_group
PRESET_OPTIONS,
CUSTOM_OPTIONS,
DEVELOPER_OPTIONS,
+ PROTOCOL_EXTENSION,
};
/*
--
2.34.1