mirror of https://github.com/citusdata/citus.git
fixup! Removes support for old protocols in Copy functions from PG14
parent
b760ec769c
commit
c01e989c6d
|
@ -1808,26 +1808,7 @@ static void
|
|||
SendCopyBegin(CopyOutState cstate)
|
||||
{
|
||||
#if PG_VERSION_NUM < PG_VERSION_14
|
||||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
|
||||
{
|
||||
/* new way */
|
||||
#endif
|
||||
StringInfoData buf;
|
||||
int natts = list_length(cstate->attnumlist);
|
||||
int16 format = (cstate->binary ? 1 : 0);
|
||||
int i;
|
||||
|
||||
pq_beginmessage(&buf, 'H');
|
||||
pq_sendbyte(&buf, format); /* overall format */
|
||||
pq_sendint16(&buf, natts);
|
||||
for (i = 0; i < natts; i++)
|
||||
pq_sendint16(&buf, format); /* per-column formats */
|
||||
pq_endmessage(&buf);
|
||||
cstate->copy_dest = COPY_FRONTEND_COMPAT;
|
||||
#if PG_VERSION_NUM < PG_VERSION_14
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) {
|
||||
/* old way */
|
||||
if (cstate->binary)
|
||||
ereport(ERROR,
|
||||
|
@ -1837,8 +1818,21 @@ SendCopyBegin(CopyOutState cstate)
|
|||
/* grottiness needed for old COPY OUT protocol */
|
||||
pq_startcopyout();
|
||||
cstate->copy_dest = COPY_OLD_FE;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
StringInfoData buf;
|
||||
int natts = list_length(cstate->attnumlist);
|
||||
int16 format = (cstate->binary ? 1 : 0);
|
||||
int i;
|
||||
|
||||
pq_beginmessage(&buf, 'H');
|
||||
pq_sendbyte(&buf, format); /* overall format */
|
||||
pq_sendint16(&buf, natts);
|
||||
for (i = 0; i < natts; i++)
|
||||
pq_sendint16(&buf, format); /* per-column formats */
|
||||
pq_endmessage(&buf);
|
||||
cstate->copy_dest = COPY_FRONTEND;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1847,23 +1841,19 @@ static void
|
|||
SendCopyEnd(CopyOutState cstate)
|
||||
{
|
||||
#if PG_VERSION_NUM < PG_VERSION_14
|
||||
if (cstate->copy_dest == COPY_NEW_FE)
|
||||
{
|
||||
#endif
|
||||
/* Shouldn't have any unsent data */
|
||||
Assert(cstate->fe_msgbuf->len == 0);
|
||||
/* Send Copy Done message */
|
||||
pq_putemptymessage('c');
|
||||
#if PG_VERSION_NUM < PG_VERSION_14
|
||||
}
|
||||
else
|
||||
if (cstate->copy_dest != COPY_NEW_FE)
|
||||
{
|
||||
CopySendData(cstate, "\\.", 2);
|
||||
/* Need to flush out the trailer (this also appends a newline) */
|
||||
CopySendEndOfRow(cstate, true);
|
||||
pq_endcopyout(false);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
/* Shouldn't have any unsent data */
|
||||
Assert(cstate->fe_msgbuf->len == 0);
|
||||
/* Send Copy Done message */
|
||||
pq_putemptymessage('c');
|
||||
}
|
||||
|
||||
|
||||
|
@ -1932,7 +1922,7 @@ CopySendEndOfRow(CopyOutState cstate, bool includeEndOfLine)
|
|||
}
|
||||
break;
|
||||
#endif
|
||||
case COPY_FRONTEND_COMPAT:
|
||||
case COPY_FRONTEND:
|
||||
/* The FE/BE protocol uses \n as newline for all platforms */
|
||||
if (!cstate->binary && includeEndOfLine)
|
||||
CopySendChar(cstate, '\n');
|
||||
|
|
|
@ -46,7 +46,6 @@
|
|||
standard_ProcessUtility(a, b, c, d, e, f, g, h)
|
||||
#define ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||
ProcessUtility(a, b, c, d, e, f, g, h)
|
||||
#define COPY_FRONTEND_COMPAT COPY_FRONTEND
|
||||
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
||||
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
||||
|
@ -81,7 +80,7 @@
|
|||
#define standard_ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||
standard_ProcessUtility(a, b, d, e, f, g, h)
|
||||
#define ProcessUtility_compat(a, b, c, d, e, f, g, h) ProcessUtility(a, b, d, e, f, g, h)
|
||||
#define COPY_FRONTEND_COMPAT COPY_NEW_FE
|
||||
#define COPY_FRONTEND COPY_NEW_FE
|
||||
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||
SetTuplestoreDestReceiverParams(a, b, c, d)
|
||||
#define pgproc_statusflags_compat(pgproc) \
|
||||
|
|
Loading…
Reference in New Issue