Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions src/option.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,6 @@ static bool
is_ch_option(const char* keyword);
static bool
parse_min_tls_version(const char* val, tls_version* out);
static bool
parse_encoding_check(const char* val, pgch_encoding_check* out);

/*
* Validate the generic options given to a FOREIGN DATA WRAPPER, SERVER,
Expand Down Expand Up @@ -172,7 +170,7 @@ clickhouse_fdw_validator(PG_FUNCTION_ARGS) {
const char* val = defGetString(def);
pgch_encoding_check v;

if (!parse_encoding_check(val, &v)) {
if (!pgch_parse_encoding_check(val, &v)) {
ereport(
ERROR,
errcode(ERRCODE_FDW_INVALID_STRING_FORMAT),
Expand Down Expand Up @@ -278,23 +276,6 @@ parse_min_tls_version(const char* val, tls_version* out) {
return true;
}

/* Map an encoding_check option value to pgch_encoding_check. */
static bool
parse_encoding_check(const char* val, pgch_encoding_check* out) {
if (pg_strcasecmp(val, "replace") == 0) {
*out = CHC_ENC_REPLACE;
} else if (pg_strcasecmp(val, "remove") == 0) {
*out = CHC_ENC_REMOVE;
} else if (pg_strcasecmp(val, "truncate") == 0) {
*out = CHC_ENC_TRUNCATE;
} else if (pg_strcasecmp(val, "fail") == 0) {
*out = CHC_ENC_FAIL;
} else {
return false;
}
return true;
}

/*
* Check whether the given option is one of the valid clickhouse_fdw options.
* context is the Oid of the catalog holding the object the option is for.
Expand Down Expand Up @@ -363,7 +344,7 @@ chfdw_extract_options(
*driver = defGetString(def);
} else if (encoding_check && strcmp(def->defname, "encoding_check") == 0) {
/* invalid values rejected by the validator; ignore here */
parse_encoding_check(defGetString(def), encoding_check);
pgch_parse_encoding_check(defGetString(def), encoding_check);
}

if (is_ch_option(def->defname)) {
Expand Down
Loading