initialize this plugin */
| 159 | |
| 160 | /* initialize this plugin */ |
| 161 | static void |
| 162 | pg_decode_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt, |
| 163 | bool is_init) |
| 164 | { |
| 165 | ListCell *option; |
| 166 | TestDecodingData *data; |
| 167 | bool enable_streaming = false; |
| 168 | |
| 169 | data = palloc0(sizeof(TestDecodingData)); |
| 170 | data->context = AllocSetContextCreate(ctx->context, |
| 171 | "text conversion context", |
| 172 | ALLOCSET_DEFAULT_SIZES); |
| 173 | data->include_xids = true; |
| 174 | data->include_timestamp = false; |
| 175 | data->skip_empty_xacts = false; |
| 176 | data->only_local = false; |
| 177 | |
| 178 | ctx->output_plugin_private = data; |
| 179 | |
| 180 | opt->output_type = OUTPUT_PLUGIN_TEXTUAL_OUTPUT; |
| 181 | opt->receive_rewrites = false; |
| 182 | |
| 183 | foreach(option, ctx->output_plugin_options) |
| 184 | { |
| 185 | DefElem *elem = lfirst(option); |
| 186 | |
| 187 | Assert(elem->arg == NULL || IsA(elem->arg, String)); |
| 188 | |
| 189 | if (strcmp(elem->defname, "include-xids") == 0) |
| 190 | { |
| 191 | /* if option does not provide a value, it means its value is true */ |
| 192 | if (elem->arg == NULL) |
| 193 | data->include_xids = true; |
| 194 | else if (!parse_bool(strVal(elem->arg), &data->include_xids)) |
| 195 | ereport(ERROR, |
| 196 | (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
| 197 | errmsg("could not parse value \"%s\" for parameter \"%s\"", |
| 198 | strVal(elem->arg), elem->defname))); |
| 199 | } |
| 200 | else if (strcmp(elem->defname, "include-timestamp") == 0) |
| 201 | { |
| 202 | if (elem->arg == NULL) |
| 203 | data->include_timestamp = true; |
| 204 | else if (!parse_bool(strVal(elem->arg), &data->include_timestamp)) |
| 205 | ereport(ERROR, |
| 206 | (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
| 207 | errmsg("could not parse value \"%s\" for parameter \"%s\"", |
| 208 | strVal(elem->arg), elem->defname))); |
| 209 | } |
| 210 | else if (strcmp(elem->defname, "force-binary") == 0) |
| 211 | { |
| 212 | bool force_binary; |
| 213 | |
| 214 | if (elem->arg == NULL) |
| 215 | continue; |
| 216 | else if (!parse_bool(strVal(elem->arg), &force_binary)) |
| 217 | ereport(ERROR, |
| 218 | (errcode(ERRCODE_INVALID_PARAMETER_VALUE), |
nothing calls this directly
no test coverage detected