Drop server support for FE/BE protocol version 1.0.
While this isn't a lot of code, it's been essentially untestable for a very long time, because libpq doesn't support anything older than protocol 2.0, and has not since release 6.3. There's no reason to believe any other client-side code still uses that protocol, either. Discussion: <2661.1475849167@sss.pgh.pa.us>
This commit is contained in:
parent
2b860f52ed
commit
2f1eaf87e8
@ -229,9 +229,7 @@ SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats)
|
|||||||
atttypid = getBaseTypeAndTypmod(atttypid, &atttypmod);
|
atttypid = getBaseTypeAndTypmod(atttypid, &atttypmod);
|
||||||
pq_sendint(&buf, (int) atttypid, sizeof(atttypid));
|
pq_sendint(&buf, (int) atttypid, sizeof(atttypid));
|
||||||
pq_sendint(&buf, attrs[i]->attlen, sizeof(attrs[i]->attlen));
|
pq_sendint(&buf, attrs[i]->attlen, sizeof(attrs[i]->attlen));
|
||||||
/* typmod appears in protocol 2.0 and up */
|
pq_sendint(&buf, atttypmod, sizeof(atttypmod));
|
||||||
if (proto >= 2)
|
|
||||||
pq_sendint(&buf, atttypmod, sizeof(atttypmod));
|
|
||||||
/* format info appears in protocol 3.0 and up */
|
/* format info appears in protocol 3.0 and up */
|
||||||
if (proto >= 3)
|
if (proto >= 3)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +353,7 @@ SendCopyBegin(CopyState cstate)
|
|||||||
pq_endmessage(&buf);
|
pq_endmessage(&buf);
|
||||||
cstate->copy_dest = COPY_NEW_FE;
|
cstate->copy_dest = COPY_NEW_FE;
|
||||||
}
|
}
|
||||||
else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
|
else
|
||||||
{
|
{
|
||||||
/* old way */
|
/* old way */
|
||||||
if (cstate->binary)
|
if (cstate->binary)
|
||||||
@ -365,18 +365,6 @@ SendCopyBegin(CopyState cstate)
|
|||||||
pq_startcopyout();
|
pq_startcopyout();
|
||||||
cstate->copy_dest = COPY_OLD_FE;
|
cstate->copy_dest = COPY_OLD_FE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* very old way */
|
|
||||||
if (cstate->binary)
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
|
||||||
errmsg("COPY BINARY is not supported to stdout or from stdin")));
|
|
||||||
pq_putemptymessage('B');
|
|
||||||
/* grottiness needed for old COPY OUT protocol */
|
|
||||||
pq_startcopyout();
|
|
||||||
cstate->copy_dest = COPY_OLD_FE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -399,7 +387,7 @@ ReceiveCopyBegin(CopyState cstate)
|
|||||||
cstate->copy_dest = COPY_NEW_FE;
|
cstate->copy_dest = COPY_NEW_FE;
|
||||||
cstate->fe_msgbuf = makeStringInfo();
|
cstate->fe_msgbuf = makeStringInfo();
|
||||||
}
|
}
|
||||||
else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
|
else
|
||||||
{
|
{
|
||||||
/* old way */
|
/* old way */
|
||||||
if (cstate->binary)
|
if (cstate->binary)
|
||||||
@ -411,18 +399,6 @@ ReceiveCopyBegin(CopyState cstate)
|
|||||||
pq_startmsgread();
|
pq_startmsgread();
|
||||||
cstate->copy_dest = COPY_OLD_FE;
|
cstate->copy_dest = COPY_OLD_FE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
/* very old way */
|
|
||||||
if (cstate->binary)
|
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
|
||||||
errmsg("COPY BINARY is not supported to stdout or from stdin")));
|
|
||||||
pq_putemptymessage('D');
|
|
||||||
/* any error in old protocol will make us lose sync */
|
|
||||||
pq_startmsgread();
|
|
||||||
cstate->copy_dest = COPY_OLD_FE;
|
|
||||||
}
|
|
||||||
/* We *must* flush here to ensure FE knows it can send. */
|
/* We *must* flush here to ensure FE knows it can send. */
|
||||||
pq_flush();
|
pq_flush();
|
||||||
}
|
}
|
||||||
|
@ -218,8 +218,8 @@ NullCommand(CommandDest dest)
|
|||||||
/* ----------------
|
/* ----------------
|
||||||
* ReadyForQuery - tell dest that we are ready for a new query
|
* ReadyForQuery - tell dest that we are ready for a new query
|
||||||
*
|
*
|
||||||
* The ReadyForQuery message is sent in protocol versions 2.0 and up
|
* The ReadyForQuery message is sent so that the FE can tell when
|
||||||
* so that the FE can tell when we are done processing a query string.
|
* we are done processing a query string.
|
||||||
* In versions 3.0 and up, it also carries a transaction state indicator.
|
* In versions 3.0 and up, it also carries a transaction state indicator.
|
||||||
*
|
*
|
||||||
* Note that by flushing the stdio buffer here, we can avoid doing it
|
* Note that by flushing the stdio buffer here, we can avoid doing it
|
||||||
@ -241,7 +241,7 @@ ReadyForQuery(CommandDest dest)
|
|||||||
pq_sendbyte(&buf, TransactionBlockStatusCode());
|
pq_sendbyte(&buf, TransactionBlockStatusCode());
|
||||||
pq_endmessage(&buf);
|
pq_endmessage(&buf);
|
||||||
}
|
}
|
||||||
else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
|
else
|
||||||
pq_putemptymessage('Z');
|
pq_putemptymessage('Z');
|
||||||
/* Flush output at end of cycle in any case. */
|
/* Flush output at end of cycle in any case. */
|
||||||
pq_flush();
|
pq_flush();
|
||||||
|
@ -3768,8 +3768,7 @@ PostgresMain(int argc, char *argv[],
|
|||||||
/*
|
/*
|
||||||
* Send this backend's cancellation info to the frontend.
|
* Send this backend's cancellation info to the frontend.
|
||||||
*/
|
*/
|
||||||
if (whereToSendOutput == DestRemote &&
|
if (whereToSendOutput == DestRemote)
|
||||||
PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
|
|
||||||
{
|
{
|
||||||
StringInfoData buf;
|
StringInfoData buf;
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ typedef struct
|
|||||||
|
|
||||||
/* The earliest and latest frontend/backend protocol version supported. */
|
/* The earliest and latest frontend/backend protocol version supported. */
|
||||||
|
|
||||||
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(1,0)
|
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(2,0)
|
||||||
#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,0)
|
#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,0)
|
||||||
|
|
||||||
typedef uint32 ProtocolVersion; /* FE/BE protocol version number */
|
typedef uint32 ProtocolVersion; /* FE/BE protocol version number */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user