mirror of https://github.com/citusdata/citus.git
fixup! Removes support for old protocols in Copy functions from PG14
parent
b760ec769c
commit
c01e989c6d
|
@ -1808,9 +1808,18 @@ static void
|
||||||
SendCopyBegin(CopyOutState cstate)
|
SendCopyBegin(CopyOutState cstate)
|
||||||
{
|
{
|
||||||
#if PG_VERSION_NUM < PG_VERSION_14
|
#if PG_VERSION_NUM < PG_VERSION_14
|
||||||
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
|
if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) {
|
||||||
{
|
/* old way */
|
||||||
/* new way */
|
if (cstate->binary)
|
||||||
|
ereport(ERROR,
|
||||||
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("COPY BINARY is not supported to stdout or from stdin")));
|
||||||
|
pq_putemptymessage('H');
|
||||||
|
/* grottiness needed for old COPY OUT protocol */
|
||||||
|
pq_startcopyout();
|
||||||
|
cstate->copy_dest = COPY_OLD_FE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
StringInfoData buf;
|
StringInfoData buf;
|
||||||
int natts = list_length(cstate->attnumlist);
|
int natts = list_length(cstate->attnumlist);
|
||||||
|
@ -1823,22 +1832,7 @@ SendCopyBegin(CopyOutState cstate)
|
||||||
for (i = 0; i < natts; i++)
|
for (i = 0; i < natts; i++)
|
||||||
pq_sendint16(&buf, format); /* per-column formats */
|
pq_sendint16(&buf, format); /* per-column formats */
|
||||||
pq_endmessage(&buf);
|
pq_endmessage(&buf);
|
||||||
cstate->copy_dest = COPY_FRONTEND_COMPAT;
|
cstate->copy_dest = COPY_FRONTEND;
|
||||||
#if PG_VERSION_NUM < PG_VERSION_14
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* 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('H');
|
|
||||||
/* grottiness needed for old COPY OUT protocol */
|
|
||||||
pq_startcopyout();
|
|
||||||
cstate->copy_dest = COPY_OLD_FE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1847,23 +1841,19 @@ static void
|
||||||
SendCopyEnd(CopyOutState cstate)
|
SendCopyEnd(CopyOutState cstate)
|
||||||
{
|
{
|
||||||
#if PG_VERSION_NUM < PG_VERSION_14
|
#if PG_VERSION_NUM < PG_VERSION_14
|
||||||
if (cstate->copy_dest == COPY_NEW_FE)
|
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
|
|
||||||
{
|
{
|
||||||
CopySendData(cstate, "\\.", 2);
|
CopySendData(cstate, "\\.", 2);
|
||||||
/* Need to flush out the trailer (this also appends a newline) */
|
/* Need to flush out the trailer (this also appends a newline) */
|
||||||
CopySendEndOfRow(cstate, true);
|
CopySendEndOfRow(cstate, true);
|
||||||
pq_endcopyout(false);
|
pq_endcopyout(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#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;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case COPY_FRONTEND_COMPAT:
|
case COPY_FRONTEND:
|
||||||
/* The FE/BE protocol uses \n as newline for all platforms */
|
/* The FE/BE protocol uses \n as newline for all platforms */
|
||||||
if (!cstate->binary && includeEndOfLine)
|
if (!cstate->binary && includeEndOfLine)
|
||||||
CopySendChar(cstate, '\n');
|
CopySendChar(cstate, '\n');
|
||||||
|
|
|
@ -46,7 +46,6 @@
|
||||||
standard_ProcessUtility(a, b, c, d, e, f, g, h)
|
standard_ProcessUtility(a, b, c, d, e, f, g, h)
|
||||||
#define ProcessUtility_compat(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)
|
ProcessUtility(a, b, c, d, e, f, g, h)
|
||||||
#define COPY_FRONTEND_COMPAT COPY_FRONTEND
|
|
||||||
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||||
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
SetTuplestoreDestReceiverParams(a, b, c, d, e, f)
|
||||||
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
#define pgproc_statusflags_compat(pgproc) ((pgproc)->statusFlags)
|
||||||
|
@ -81,7 +80,7 @@
|
||||||
#define standard_ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
#define standard_ProcessUtility_compat(a, b, c, d, e, f, g, h) \
|
||||||
standard_ProcessUtility(a, b, 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 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) \
|
#define SetTuplestoreDestReceiverParams_compat(a, b, c, d, e, f) \
|
||||||
SetTuplestoreDestReceiverParams(a, b, c, d)
|
SetTuplestoreDestReceiverParams(a, b, c, d)
|
||||||
#define pgproc_statusflags_compat(pgproc) \
|
#define pgproc_statusflags_compat(pgproc) \
|
||||||
|
|
Loading…
Reference in New Issue