A suspicious code in pgoutput_startup().

From: Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: A suspicious code in pgoutput_startup().
Date: 2017-07-28 00:52:06
Message-ID: 20170728095206.bf82da64.nagata@sraoss.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I found a suspicious code in pgoutput_startup().

175 /* Check if we support requested protocol */
176 if (data->protocol_version != LOGICALREP_PROTO_VERSION_NUM)
177 ereport(ERROR,
178 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
179 errmsg("client sent proto_version=%d but we only support protocol %d or lower",
180 data->protocol_version, LOGICALREP_PROTO_VERSION_NUM)));

Although the if condition is not-equal, the error message says
"we only support protocol %d or lower". Is this intentional?
Or should this be fixed as below?

176 if (data->protocol_version > LOGICALREP_PROTO_VERSION_NUM)

Attached is a simple patch in case of fixing.

Regards,

--
Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp>

Attachment Content-Type Size
pgoutput.patch text/x-diff 689 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-07-28 01:26:56 Re: LP_DEAD hinting and not holding on to a buffer pin on leaf page (Was: [WIP] Zipfian distribution in pgbench)
Previous Message Yugo Nagata 2017-07-28 00:51:17 Notice message of ALTER SUBSCRIPTION ... RERESH PUBLICATIION