From b99674dcf926b223186cad0b305477a07b9d2e2a Mon Sep 17 00:00:00 2001 From: gindibay Date: Mon, 9 Oct 2023 13:46:54 +0300 Subject: [PATCH] Removes T_Boolean since it breaks pg14 compile --- .../distributed/deparser/citus_deparseutils.c | 46 ++++++++----------- .../deparser/deparse_database_stmts.c | 24 +++++----- src/include/distributed/deparser.h | 2 +- 3 files changed, 31 insertions(+), 41 deletions(-) diff --git a/src/backend/distributed/deparser/citus_deparseutils.c b/src/backend/distributed/deparser/citus_deparseutils.c index 9b694e726..9e65f5700 100644 --- a/src/backend/distributed/deparser/citus_deparseutils.c +++ b/src/backend/distributed/deparser/citus_deparseutils.c @@ -20,36 +20,26 @@ handleOption(StringInfo buf, DefElem *option, const struct option_format *opt_fo { if (strcmp(name, opt_formats[i].name) == 0) { - switch (opt_formats[i].type) + if (strcmp(opt_formats[i].type, "string") == 0) { - case T_String: - { - char *value = defGetString(option); - appendStringInfo(buf, opt_formats[i].format, quote_identifier(value)); - break; - } - - case T_Integer: - { - int32 value = defGetInt32(option); - appendStringInfo(buf, opt_formats[i].format, value); - break; - } - - case T_Boolean: - { - bool value = defGetBoolean(option); - appendStringInfo(buf, opt_formats[i].format, value ? "true" : - "false"); - break; - } - - default: - - /* Should not happen */ - elog(ERROR, "unrecognized option type: %d", opt_formats[i].type); + char *value = defGetString(option); + appendStringInfo(buf, opt_formats[i].format, quote_identifier(value)); } - return; + else if (strcmp(opt_formats[i].type, "integer") == 0) + { + int32 value = defGetInt32(option); + appendStringInfo(buf, opt_formats[i].format, value); + } + else if (strcmp(opt_formats[i].type, "boolean") == 0) + { + bool value = defGetBoolean(option); + appendStringInfo(buf, opt_formats[i].format, value ? "true" : "false"); + } + else + { + elog(ERROR, "unrecognized option type: %s", opt_formats[i].type); + } + break; } } } diff --git a/src/backend/distributed/deparser/deparse_database_stmts.c b/src/backend/distributed/deparser/deparse_database_stmts.c index 6ae0a0e59..094c6fc1e 100644 --- a/src/backend/distributed/deparser/deparse_database_stmts.c +++ b/src/backend/distributed/deparser/deparse_database_stmts.c @@ -208,18 +208,18 @@ DeparseAlterDatabaseSetStmt(Node *node) const struct option_format option_formats[] = { - { "template", " TEMPLATE %s", T_String }, - { "owner", " OWNER %s", T_String }, - { "tablespace", " TABLESPACE %s", T_String }, - { "connection_limit", " CONNECTION LIMIT %d", T_Integer }, - { "encoding", " ENCODING %s", T_String }, - { "lc_collate", " LC_COLLATE %s", T_String }, - { "lc_ctype", " LC_CTYPE %s", T_String }, - { "icu_locale", " ICU_LOCALE %s", T_String }, - { "icu_rules", " ICU_RULES %s", T_String }, - { "locale_provider", " LOCALE_PROVIDER %s", T_String }, - { "is_template", " IS_TEMPLATE %s", T_Boolean }, - { "allow_connections", " ALLOW_CONNECTIONS %s", T_Boolean }, + { "template", " TEMPLATE %s", "string" }, + { "owner", " OWNER %s", "string" }, + { "tablespace", " TABLESPACE %s", "string" }, + { "connection_limit", " CONNECTION LIMIT %d", "integer" }, + { "encoding", " ENCODING %s", "string" }, + { "lc_collate", " LC_COLLATE %s", "string" }, + { "lc_ctype", " LC_CTYPE %s", "string" }, + { "icu_locale", " ICU_LOCALE %s", "string" }, + { "icu_rules", " ICU_RULES %s", "string" }, + { "locale_provider", " LOCALE_PROVIDER %s", "string" }, + { "is_template", " IS_TEMPLATE %s", "boolean" }, + { "allow_connections", " ALLOW_CONNECTIONS %s", "boolean" }, }; diff --git a/src/include/distributed/deparser.h b/src/include/distributed/deparser.h index b55287978..428c91a5f 100644 --- a/src/include/distributed/deparser.h +++ b/src/include/distributed/deparser.h @@ -127,7 +127,7 @@ struct option_format { const char *name; const char *format; - int type; + const char *type; };