There is no need for a comma after the last message.
Done. Thanks for noticing it.
2. +/* + * Logical message types + * + * Used by logical replication wire protocol. + * + * Note: though this is an enum it should fit a single byte and should be a + * printable character. + */ +typedef enum +{
I think we can expand the comments to probably say why we need these to fit in a single byte or what problem it can cause if that rule is disobeyed. This is to make the next person clear why we are imposing such a rule.
Done. Please check.
3. +typedef enum +{ .. +} LogicalRepMsgType;
There are places in code where we use the enum name (LogicalRepMsgType) both in the start and end. See TypeCat, CoercionMethod, CoercionCodes, etc. I see places where we use the way you have in the code. I would prefer the way we have used at places like TypeCat as that makes it easier to read.
Not my favourite style since changing the type name requires changing enum name to keep those consistent. But anyway done.
4. switch (action) { - /* BEGIN */ - case 'B': + case LOGICAL_REP_MSG_BEGIN: apply_handle_begin(s); - break; - /* COMMIT */ - case 'C': + return;
I think we can simply use 'return apply_handle_begin;' instead of adding return in another line. Again, I think we changed this handling in apply_dispatch() to improve the case where we can detect at the compile time any missing enum but at this stage it is not clear to me if that is true.
I don't see much value in writing it like "return apply_handle_begin()"; gives an impression that apply_handle_begin() and apply_dispatch() are returning something which they are not. I would prefer return on separate line unless there's something more than style improvement.
I have added rationale behind Enum in the commit message as you suggested in one of the later mails.