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)
{
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;
}
}
}

View File

@ -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" },
};

View File

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