pgoutput: Raise an error for missing protocol version parameter.
Currently, we give a misleading error if the user omits to pass the required parameter 'proto_version' in SQL API pg_logical_slot_get_changes() or during START_REPLICATION protocol message. The error raised is as follows which indicates that the wrong version is passed. ERROR: client sent proto_version=0 but server only supports protocol 1 or higher Author: Emre Hasegeli Reviewed-by: Peter Smith, Amit Kapila Discussion: https://postgr.es/m/CAE2gYzwdwtUbs-tPSV-QBwgTubiyGD2ZGsSnAVsDfAGGLDrGOA@mail.gmail.com
This commit is contained in:
parent
8b965c549d
commit
c8bc807cf8
@ -400,6 +400,16 @@ parse_output_parameters(List *options, PGOutputData *data)
|
|||||||
else
|
else
|
||||||
elog(ERROR, "unrecognized pgoutput option: %s", defel->defname);
|
elog(ERROR, "unrecognized pgoutput option: %s", defel->defname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check required options */
|
||||||
|
if (!protocol_version_given)
|
||||||
|
ereport(ERROR,
|
||||||
|
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
|
errmsg("proto_version option missing"));
|
||||||
|
if (!publication_names_given)
|
||||||
|
ereport(ERROR,
|
||||||
|
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
||||||
|
errmsg("publication_names option missing"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -449,11 +459,6 @@ pgoutput_startup(LogicalDecodingContext *ctx, OutputPluginOptions *opt,
|
|||||||
errmsg("client sent proto_version=%d but server only supports protocol %d or higher",
|
errmsg("client sent proto_version=%d but server only supports protocol %d or higher",
|
||||||
data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM)));
|
data->protocol_version, LOGICALREP_PROTO_MIN_VERSION_NUM)));
|
||||||
|
|
||||||
if (data->publication_names == NIL)
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
|
|
||||||
errmsg("publication_names parameter missing")));
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Decide whether to enable streaming. It is disabled by default, in
|
* Decide whether to enable streaming. It is disabled by default, in
|
||||||
* which case we just update the flag in decoding context. Otherwise
|
* which case we just update the flag in decoding context. Otherwise
|
||||||
|
Loading…
x
Reference in New Issue
Block a user