Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2f1eaf8

Browse files
committed
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>
1 parent 2b860f5 commit 2f1eaf8

File tree

5 files changed

+8
-35
lines changed

5 files changed

+8
-35
lines changed

src/backend/access/common/printtup.c

+1-3
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist, int16 *formats)
229229
atttypid = getBaseTypeAndTypmod(atttypid, &atttypmod);
230230
pq_sendint(&buf, (int) atttypid, sizeof(atttypid));
231231
pq_sendint(&buf, attrs[i]->attlen, sizeof(attrs[i]->attlen));
232-
/* typmod appears in protocol 2.0 and up */
233-
if (proto >= 2)
234-
pq_sendint(&buf, atttypmod, sizeof(atttypmod));
232+
pq_sendint(&buf, atttypmod, sizeof(atttypmod));
235233
/* format info appears in protocol 3.0 and up */
236234
if (proto >= 3)
237235
{

src/backend/commands/copy.c

+2-26
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ SendCopyBegin(CopyState cstate)
353353
pq_endmessage(&buf);
354354
cstate->copy_dest = COPY_NEW_FE;
355355
}
356-
else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
356+
else
357357
{
358358
/* old way */
359359
if (cstate->binary)
@@ -365,18 +365,6 @@ SendCopyBegin(CopyState cstate)
365365
pq_startcopyout();
366366
cstate->copy_dest = COPY_OLD_FE;
367367
}
368-
else
369-
{
370-
/* very old way */
371-
if (cstate->binary)
372-
ereport(ERROR,
373-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
374-
errmsg("COPY BINARY is not supported to stdout or from stdin")));
375-
pq_putemptymessage('B');
376-
/* grottiness needed for old COPY OUT protocol */
377-
pq_startcopyout();
378-
cstate->copy_dest = COPY_OLD_FE;
379-
}
380368
}
381369

382370
static void
@@ -399,7 +387,7 @@ ReceiveCopyBegin(CopyState cstate)
399387
cstate->copy_dest = COPY_NEW_FE;
400388
cstate->fe_msgbuf = makeStringInfo();
401389
}
402-
else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
390+
else
403391
{
404392
/* old way */
405393
if (cstate->binary)
@@ -411,18 +399,6 @@ ReceiveCopyBegin(CopyState cstate)
411399
pq_startmsgread();
412400
cstate->copy_dest = COPY_OLD_FE;
413401
}
414-
else
415-
{
416-
/* very old way */
417-
if (cstate->binary)
418-
ereport(ERROR,
419-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
420-
errmsg("COPY BINARY is not supported to stdout or from stdin")));
421-
pq_putemptymessage('D');
422-
/* any error in old protocol will make us lose sync */
423-
pq_startmsgread();
424-
cstate->copy_dest = COPY_OLD_FE;
425-
}
426402
/* We *must* flush here to ensure FE knows it can send. */
427403
pq_flush();
428404
}

src/backend/tcop/dest.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ NullCommand(CommandDest dest)
218218
/* ----------------
219219
* ReadyForQuery - tell dest that we are ready for a new query
220220
*
221-
* The ReadyForQuery message is sent in protocol versions 2.0 and up
222-
* so that the FE can tell when we are done processing a query string.
221+
* The ReadyForQuery message is sent so that the FE can tell when
222+
* we are done processing a query string.
223223
* In versions 3.0 and up, it also carries a transaction state indicator.
224224
*
225225
* Note that by flushing the stdio buffer here, we can avoid doing it
@@ -241,7 +241,7 @@ ReadyForQuery(CommandDest dest)
241241
pq_sendbyte(&buf, TransactionBlockStatusCode());
242242
pq_endmessage(&buf);
243243
}
244-
else if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
244+
else
245245
pq_putemptymessage('Z');
246246
/* Flush output at end of cycle in any case. */
247247
pq_flush();

src/backend/tcop/postgres.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -3768,8 +3768,7 @@ PostgresMain(int argc, char *argv[],
37683768
/*
37693769
* Send this backend's cancellation info to the frontend.
37703770
*/
3771-
if (whereToSendOutput == DestRemote &&
3772-
PG_PROTOCOL_MAJOR(FrontendProtocol) >= 2)
3771+
if (whereToSendOutput == DestRemote)
37733772
{
37743773
StringInfoData buf;
37753774

src/include/libpq/pqcomm.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ typedef struct
107107

108108
/* The earliest and latest frontend/backend protocol version supported. */
109109

110-
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(1,0)
110+
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(2,0)
111111
#define PG_PROTOCOL_LATEST PG_PROTOCOL(3,0)
112112

113113
typedef uint32 ProtocolVersion; /* FE/BE protocol version number */

0 commit comments

Comments
 (0)