diff options
Diffstat (limited to 'src/backend/utils/misc/guc.c')
-rw-r--r-- | src/backend/utils/misc/guc.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index a16fe8cd5bf..9630866a5f9 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -241,6 +241,9 @@ static const struct config_enum_entry bytea_output_options[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(bytea_output_options) == (BYTEA_OUTPUT_HEX + 2), + "array length mismatch"); + /* * We have different sets for client and server message level options because * they sort slightly different (see "log" level), and because "fatal"/"panic" @@ -286,6 +289,9 @@ static const struct config_enum_entry intervalstyle_options[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(intervalstyle_options) == (INTSTYLE_ISO_8601 + 2), + "array length mismatch"); + static const struct config_enum_entry log_error_verbosity_options[] = { {"terse", PGERROR_TERSE, false}, {"default", PGERROR_DEFAULT, false}, @@ -293,6 +299,9 @@ static const struct config_enum_entry log_error_verbosity_options[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(log_error_verbosity_options) == (PGERROR_VERBOSE + 2), + "array length mismatch"); + static const struct config_enum_entry log_statement_options[] = { {"none", LOGSTMT_NONE, false}, {"ddl", LOGSTMT_DDL, false}, @@ -301,6 +310,9 @@ static const struct config_enum_entry log_statement_options[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(log_statement_options) == (LOGSTMT_ALL + 2), + "array length mismatch"); + static const struct config_enum_entry isolation_level_options[] = { {"serializable", XACT_SERIALIZABLE, false}, {"repeatable read", XACT_REPEATABLE_READ, false}, @@ -316,6 +328,9 @@ static const struct config_enum_entry session_replication_role_options[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(session_replication_role_options) == (SESSION_REPLICATION_ROLE_LOCAL + 2), + "array length mismatch"); + static const struct config_enum_entry syslog_facility_options[] = { #ifdef HAVE_SYSLOG {"local0", LOG_LOCAL0, false}, @@ -339,18 +354,27 @@ static const struct config_enum_entry track_function_options[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(track_function_options) == (TRACK_FUNC_ALL + 2), + "array length mismatch"); + static const struct config_enum_entry xmlbinary_options[] = { {"base64", XMLBINARY_BASE64, false}, {"hex", XMLBINARY_HEX, false}, {NULL, 0, false} }; +StaticAssertDecl(lengthof(xmlbinary_options) == (XMLBINARY_HEX + 2), + "array length mismatch"); + static const struct config_enum_entry xmloption_options[] = { {"content", XMLOPTION_CONTENT, false}, {"document", XMLOPTION_DOCUMENT, false}, {NULL, 0, false} }; +StaticAssertDecl(lengthof(xmloption_options) == (XMLOPTION_CONTENT + 2), + "array length mismatch"); + /* * Although only "on", "off", and "safe_encoding" are documented, we * accept all the likely variants of "on" and "off". @@ -465,6 +489,9 @@ const struct config_enum_entry ssl_protocol_versions_info[] = { {NULL, 0, false} }; +StaticAssertDecl(lengthof(ssl_protocol_versions_info) == (PG_TLS1_3_VERSION + 2), + "array length mismatch"); + static struct config_enum_entry shared_memory_options[] = { #ifndef WIN32 {"sysv", SHMEM_TYPE_SYSV, false}, @@ -615,6 +642,9 @@ const char *const GucContext_Names[] = /* PGC_USERSET */ "user" }; +StaticAssertDecl(lengthof(GucContext_Names) == (PGC_USERSET + 1), + "array length mismatch"); + /* * Displayable names for source types (enum GucSource) * @@ -638,6 +668,9 @@ const char *const GucSource_Names[] = /* PGC_S_SESSION */ "session" }; +StaticAssertDecl(lengthof(GucSource_Names) == (PGC_S_SESSION + 1), + "array length mismatch"); + /* * Displayable names for the groupings defined in enum config_group */ @@ -749,6 +782,9 @@ const char *const config_group_names[] = NULL }; +StaticAssertDecl(lengthof(config_group_names) == (DEVELOPER_OPTIONS + 2), + "array length mismatch"); + /* * Displayable names for GUC variable types (enum config_type) * @@ -763,6 +799,9 @@ const char *const config_type_names[] = /* PGC_ENUM */ "enum" }; +StaticAssertDecl(lengthof(config_type_names) == (PGC_ENUM + 1), + "array length mismatch"); + /* * Unit conversion tables. * |