Removes T_Boolean since it breaks pg14 compile

create_drop_db_gh
gindibay 2023-10-09 13:46:54 +03:00
parent 2b04873159
commit b99674dcf9
3 changed files with 31 additions and 41 deletions

View File

@ -20,36 +20,26 @@ handleOption(StringInfo buf, DefElem *option, const struct option_format *opt_fo
{ {
if (strcmp(name, opt_formats[i].name) == 0) 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); char *value = defGetString(option);
appendStringInfo(buf, opt_formats[i].format, quote_identifier(value)); appendStringInfo(buf, opt_formats[i].format, quote_identifier(value));
break;
} }
else if (strcmp(opt_formats[i].type, "integer") == 0)
case T_Integer:
{ {
int32 value = defGetInt32(option); int32 value = defGetInt32(option);
appendStringInfo(buf, opt_formats[i].format, value); appendStringInfo(buf, opt_formats[i].format, value);
break;
} }
else if (strcmp(opt_formats[i].type, "boolean") == 0)
case T_Boolean:
{ {
bool value = defGetBoolean(option); bool value = defGetBoolean(option);
appendStringInfo(buf, opt_formats[i].format, value ? "true" : appendStringInfo(buf, opt_formats[i].format, value ? "true" : "false");
"false"); }
else
{
elog(ERROR, "unrecognized option type: %s", opt_formats[i].type);
}
break; break;
} }
default:
/* Should not happen */
elog(ERROR, "unrecognized option type: %d", opt_formats[i].type);
}
return;
}
} }
} }

View File

@ -208,18 +208,18 @@ DeparseAlterDatabaseSetStmt(Node *node)
const struct option_format option_formats[] = { const struct option_format option_formats[] = {
{ "template", " TEMPLATE %s", T_String }, { "template", " TEMPLATE %s", "string" },
{ "owner", " OWNER %s", T_String }, { "owner", " OWNER %s", "string" },
{ "tablespace", " TABLESPACE %s", T_String }, { "tablespace", " TABLESPACE %s", "string" },
{ "connection_limit", " CONNECTION LIMIT %d", T_Integer }, { "connection_limit", " CONNECTION LIMIT %d", "integer" },
{ "encoding", " ENCODING %s", T_String }, { "encoding", " ENCODING %s", "string" },
{ "lc_collate", " LC_COLLATE %s", T_String }, { "lc_collate", " LC_COLLATE %s", "string" },
{ "lc_ctype", " LC_CTYPE %s", T_String }, { "lc_ctype", " LC_CTYPE %s", "string" },
{ "icu_locale", " ICU_LOCALE %s", T_String }, { "icu_locale", " ICU_LOCALE %s", "string" },
{ "icu_rules", " ICU_RULES %s", T_String }, { "icu_rules", " ICU_RULES %s", "string" },
{ "locale_provider", " LOCALE_PROVIDER %s", T_String }, { "locale_provider", " LOCALE_PROVIDER %s", "string" },
{ "is_template", " IS_TEMPLATE %s", T_Boolean }, { "is_template", " IS_TEMPLATE %s", "boolean" },
{ "allow_connections", " ALLOW_CONNECTIONS %s", T_Boolean }, { "allow_connections", " ALLOW_CONNECTIONS %s", "boolean" },
}; };

View File

@ -127,7 +127,7 @@ struct option_format
{ {
const char *name; const char *name;
const char *format; const char *format;
int type; const char *type;
}; };