From 865915e56c7f45e4728adb24eb1e0acc4b57e167 Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Fri, 5 Jan 2024 14:45:04 +0100 Subject: [PATCH v10 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 f3c09e8dc0d..fb8674bbf8a 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -2206,12 +2206,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