summaryrefslogtreecommitdiff
path: root/src/backend/tcop/dest.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2017-01-24 16:53:56 -0500
committerRobert Haas <rhaas@postgresql.org>2017-01-24 16:53:56 -0500
commita84069d9350400c860d5e932b50dfd337aa407b0 (patch)
treeac278978c902539d065211f2fb47c4a04d4b40f3 /src/backend/tcop/dest.c
parent7b4ac19982a77a1a2a6f096c4a11ee7325a14d2c (diff)
Add a new DestReceiver for printing tuples without catalog access.
If you create a DestReciver of type DestRemote and try to use it from a replication connection that is not bound to a specific daabase, or any other hypothetical type of backend that is not bound to a specific database, it will fail because it doesn't have a pg_proc catalog to look up properties of the types being printed. In general, that's an unavoidable problem, but we can hardwire the properties of a few builtin types in order to support utility commands. This new DestReceiver of type DestRemoteSimple does just that. Patch by me, reviewed by Michael Paquier. Discussion: http://postgr.es/m/CA+TgmobNo4qz06wHEmy9DszAre3dYx-WNhHSCbU9SAwf+9Ft6g@mail.gmail.com
Diffstat (limited to 'src/backend/tcop/dest.c')
-rw-r--r--src/backend/tcop/dest.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c
index da39f43f38c..28081c37654 100644
--- a/src/backend/tcop/dest.c
+++ b/src/backend/tcop/dest.c
@@ -28,6 +28,7 @@
#include "postgres.h"
+#include "access/printsimple.h"
#include "access/printtup.h"
#include "access/xact.h"
#include "commands/copy.h"
@@ -76,6 +77,11 @@ static DestReceiver debugtupDR = {
DestDebug
};
+static DestReceiver printsimpleDR = {
+ printsimple, printsimple_startup, donothingCleanup, donothingCleanup,
+ DestRemoteSimple
+};
+
static DestReceiver spi_printtupDR = {
spi_printtup, spi_dest_startup, donothingCleanup, donothingCleanup,
DestSPI
@@ -108,6 +114,9 @@ CreateDestReceiver(CommandDest dest)
case DestRemoteExecute:
return printtup_create_DR(dest);
+ case DestRemoteSimple:
+ return &printsimpleDR;
+
case DestNone:
return &donothingDR;
@@ -151,6 +160,7 @@ EndCommand(const char *commandTag, CommandDest dest)
{
case DestRemote:
case DestRemoteExecute:
+ case DestRemoteSimple:
/*
* We assume the commandTag is plain ASCII and therefore requires
@@ -191,6 +201,7 @@ NullCommand(CommandDest dest)
{
case DestRemote:
case DestRemoteExecute:
+ case DestRemoteSimple:
/*
* tell the fe that we saw an empty query string. In protocols
@@ -233,6 +244,7 @@ ReadyForQuery(CommandDest dest)
{
case DestRemote:
case DestRemoteExecute:
+ case DestRemoteSimple:
if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3)
{
StringInfoData buf;