@@ -156,17 +156,16 @@ _PG_output_plugin_init(OutputPluginCallbacks *cb)
156
156
}
157
157
158
158
static void
159
- parse_output_parameters (List * options , uint32 * protocol_version ,
160
- List * * publication_names , bool * binary ,
161
- bool * enable_streaming )
159
+ parse_output_parameters (List * options , PGOutputData * data )
162
160
{
163
161
ListCell * lc ;
164
162
bool protocol_version_given = false;
165
163
bool publication_names_given = false;
166
164
bool binary_option_given = false;
167
165
bool streaming_given = false;
168
166
169
- * binary = false;
167
+ data -> binary = false;
168
+ data -> streaming = false;
170
169
171
170
foreach (lc , options )
172
171
{
@@ -196,7 +195,7 @@ parse_output_parameters(List *options, uint32 *protocol_version,
196
195
errmsg ("proto_version \"%s\" out of range" ,
197
196
strVal (defel -> arg ))));
198
197
199
- * protocol_version = (uint32 ) parsed ;
198
+ data -> protocol_version = (uint32 ) parsed ;
200
199
}
201
200
else if (strcmp (defel -> defname , "publication_names" ) == 0 )
202
201
{
@@ -207,7 +206,7 @@ parse_output_parameters(List *options, uint32 *protocol_version,
207
206
publication_names_given = true;
208
207
209
208
if (!SplitIdentifierString (strVal (defel -> arg ), ',' ,
210
- publication_names ))
209
+ & data -> publication_names ))
211
210
ereport (ERROR ,
212
211
(errcode (ERRCODE_INVALID_NAME ),
213
212
errmsg ("invalid publication_names syntax" )));
@@ -220,7 +219,7 @@ parse_output_parameters(List *options, uint32 *protocol_version,
220
219
errmsg ("conflicting or redundant options" )));
221
220
binary_option_given = true;
222
221
223
- * binary = defGetBoolean (defel );
222
+ data -> binary = defGetBoolean (defel );
224
223
}
225
224
else if (strcmp (defel -> defname , "streaming" ) == 0 )
226
225
{
@@ -230,7 +229,7 @@ parse_output_parameters(List *options, uint32 *protocol_version,
230
229
errmsg ("conflicting or redundant options" )));
231
230
streaming_given = true;
232
231
233
- * enable_streaming = defGetBoolean (defel );
232
+ data -> streaming = defGetBoolean (defel );
234
233
}
235
234
else
236
235
elog (ERROR , "unrecognized pgoutput option: %s" , defel -> defname );
@@ -244,7 +243,6 @@ static void
244
243
pgoutput_startup (LogicalDecodingContext * ctx , OutputPluginOptions * opt ,
245
244
bool is_init )
246
245
{
247
- bool enable_streaming = false;
248
246
PGOutputData * data = palloc0 (sizeof (PGOutputData ));
249
247
250
248
/* Create our memory context for private allocations. */
@@ -265,11 +263,7 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
265
263
if (!is_init )
266
264
{
267
265
/* Parse the params and ERROR if we see any we don't recognize */
268
- parse_output_parameters (ctx -> output_plugin_options ,
269
- & data -> protocol_version ,
270
- & data -> publication_names ,
271
- & data -> binary ,
272
- & enable_streaming );
266
+ parse_output_parameters (ctx -> output_plugin_options , data );
273
267
274
268
/* Check if we support requested protocol */
275
269
if (data -> protocol_version > LOGICALREP_PROTO_MAX_VERSION_NUM )
@@ -295,7 +289,7 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
295
289
* we only allow it with sufficient version of the protocol, and when
296
290
* the output plugin supports it.
297
291
*/
298
- if (!enable_streaming )
292
+ if (!data -> streaming )
299
293
ctx -> streaming = false;
300
294
else if (data -> protocol_version < LOGICALREP_PROTO_STREAM_VERSION_NUM )
301
295
ereport (ERROR ,
0 commit comments