Commit bbd8550b authored by Robert Haas's avatar Robert Haas

Refactor other replication commands to use DestRemoteSimple.

Commit a84069d9 added a new type of
DestReceiver to avoid duplicating the existing code for the SHOW
command, but it turns out we can leverage that new DestReceiver
type in a few more places, saving some code.

Michael Paquier, reviewed by Andres Freund and by me.

Discussion: http://postgr.es/m/CAB7nPqSdFOQC0evc0r1nJeQyGBqjBrR41MC4rcMqUUpoJaZbtQ%40mail.gmail.com
Discussion: http://postgr.es/m/CAB7nPqT2K4XFT1JgqufFBjsOc-NUKXg5qBDucHPMbk6Xi1kYaA@mail.gmail.com
parent c3e3844a
......@@ -22,6 +22,7 @@
#include "catalog/pg_type.h"
#include "fmgr.h"
#include "libpq/pqformat.h"
#include "utils/builtins.h"
/*
* At startup time, send a RowDescription message.
......@@ -99,6 +100,26 @@ printsimple(TupleTableSlot *slot, DestReceiver *self)
}
break;
case INT4OID:
{
int32 num = DatumGetInt32(value);
char str[12]; /* sign, 10 digits and '\0' */
pg_ltoa(num, str);
pq_sendcountedtext(&buf, str, strlen(str), false);
}
break;
case INT8OID:
{
int64 num = DatumGetInt64(value);
char str[23]; /* sign, 21 digits and '\0' */
pg_lltoa(num, str);
pq_sendcountedtext(&buf, str, strlen(str), false);
}
break;
default:
elog(ERROR, "unsupported type OID: %u", attr->atttypid);
}
......
......@@ -629,6 +629,14 @@ TupleDescInitBuiltinEntry(TupleDesc desc,
att->attstorage = 'p';
att->attcollation = InvalidOid;
break;
case INT8OID:
att->attlen = 8;
att->attbyval = FLOAT8PASSBYVAL;
att->attalign = 'd';
att->attstorage = 'p';
att->attcollation = InvalidOid;
break;
}
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment