PostgreSQL Source Code git master
Loading...
Searching...
No Matches
dest.c File Reference
#include "postgres.h"
#include "access/printsimple.h"
#include "access/printtup.h"
#include "access/xact.h"
#include "commands/copy.h"
#include "commands/createas.h"
#include "commands/explain_dr.h"
#include "commands/matview.h"
#include "executor/functions.h"
#include "executor/tqueue.h"
#include "executor/tstoreReceiver.h"
#include "libpq/libpq.h"
#include "libpq/pqformat.h"
Include dependency graph for dest.c:

Go to the source code of this file.

Functions

static bool donothingReceive (TupleTableSlot *slot, DestReceiver *self)
 
static void donothingStartup (DestReceiver *self, int operation, TupleDesc typeinfo)
 
static void donothingCleanup (DestReceiver *self)
 
void BeginCommand (CommandTag commandTag, CommandDest dest)
 
DestReceiverCreateDestReceiver (CommandDest dest)
 
void EndCommand (const QueryCompletion *qc, CommandDest dest, bool force_undecorated_output)
 
void EndReplicationCommand (const char *commandTag)
 
void NullCommand (CommandDest dest)
 
void ReadyForQuery (CommandDest dest)
 

Variables

static const DestReceiver donothingDR
 
static const DestReceiver debugtupDR
 
static const DestReceiver printsimpleDR
 
static const DestReceiver spi_printtupDR
 
DestReceiverNone_Receiver = (DestReceiver *) &donothingDR
 

Function Documentation

◆ BeginCommand()

void BeginCommand ( CommandTag  commandTag,
CommandDest  dest 
)

Definition at line 103 of file dest.c.

104{
105 /* Nothing to do at present */
106}

Referenced by exec_execute_message(), and exec_simple_query().

◆ CreateDestReceiver()

DestReceiver * CreateDestReceiver ( CommandDest  dest)

Definition at line 113 of file dest.c.

114{
115 /*
116 * It's ok to cast the constness away as any modification of the none
117 * receiver would be a bug (which gets easier to catch this way).
118 */
119
120 switch (dest)
121 {
122 case DestRemote:
124 return printtup_create_DR(dest);
125
126 case DestRemoteSimple:
128
129 case DestNone:
131
132 case DestDebug:
134
135 case DestSPI:
137
138 case DestTuplestore:
140
141 case DestIntoRel:
143
144 case DestCopyOut:
145 return CreateCopyDestReceiver();
146
147 case DestSQLFunction:
149
150 case DestTransientRel:
152
153 case DestTupleQueue:
155
158 }
159
160 /* should never get here */
162}
#define unconstify(underlying_type, expr)
Definition c.h:1297
#define pg_unreachable()
Definition c.h:361
DestReceiver * CreateCopyDestReceiver(void)
Definition copyto.c:1531
DestReceiver * CreateIntoRelDestReceiver(IntoClause *intoClause)
Definition createas.c:440
static const DestReceiver spi_printtupDR
Definition dest.c:85
static const DestReceiver debugtupDR
Definition dest.c:75
static const DestReceiver donothingDR
Definition dest.c:70
static const DestReceiver printsimpleDR
Definition dest.c:80
@ DestSQLFunction
Definition dest.h:96
@ DestTupleQueue
Definition dest.h:98
@ DestTuplestore
Definition dest.h:93
@ DestRemote
Definition dest.h:89
@ DestDebug
Definition dest.h:88
@ DestExplainSerialize
Definition dest.h:99
@ DestRemoteSimple
Definition dest.h:91
@ DestCopyOut
Definition dest.h:95
@ DestTransientRel
Definition dest.h:97
@ DestSPI
Definition dest.h:92
@ DestIntoRel
Definition dest.h:94
@ DestRemoteExecute
Definition dest.h:90
@ DestNone
Definition dest.h:87
DestReceiver * CreateExplainSerializeDestReceiver(ExplainState *es)
Definition explain_dr.c:275
DestReceiver * CreateSQLFunctionDestReceiver(void)
Definition functions.c:2617
DestReceiver * CreateTransientRelDestReceiver(Oid transientoid)
Definition matview.c:464
#define InvalidOid
static int fb(int x)
DestReceiver * printtup_create_DR(CommandDest dest)
Definition printtup.c:72
DestReceiver * CreateTupleQueueDestReceiver(shm_mq_handle *handle)
Definition tqueue.c:119
DestReceiver * CreateTuplestoreDestReceiver(void)

References CreateCopyDestReceiver(), CreateExplainSerializeDestReceiver(), CreateIntoRelDestReceiver(), CreateSQLFunctionDestReceiver(), CreateTransientRelDestReceiver(), CreateTupleQueueDestReceiver(), CreateTuplestoreDestReceiver(), debugtupDR, DestCopyOut, DestDebug, DestExplainSerialize, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, donothingDR, fb(), InvalidOid, pg_unreachable, printsimpleDR, printtup_create_DR(), spi_printtupDR, and unconstify.

Referenced by _SPI_execute_plan(), BeginCopyTo(), CreateReplicationSlot(), exec_execute_message(), exec_replication_command(), exec_simple_query(), exec_stmt_return_query(), execute_sql_string(), FillPortalStore(), IdentifySystem(), PersistHoldablePortal(), postquel_start(), ReadReplicationSlot(), SendTablespaceList(), SendTimeLineHistory(), SendXlogRecPtrResult(), SPI_cursor_fetch(), SPI_scroll_cursor_fetch(), and StartReplication().

◆ donothingCleanup()

static void donothingCleanup ( DestReceiver self)
static

Definition at line 61 of file dest.c.

62{
63 /* this is used for both shutdown and destroy methods */
64}

◆ donothingReceive()

static bool donothingReceive ( TupleTableSlot slot,
DestReceiver self 
)
static

Definition at line 50 of file dest.c.

51{
52 return true;
53}

◆ donothingStartup()

static void donothingStartup ( DestReceiver self,
int  operation,
TupleDesc  typeinfo 
)
static

Definition at line 56 of file dest.c.

57{
58}

◆ EndCommand()

void EndCommand ( const QueryCompletion qc,
CommandDest  dest,
bool  force_undecorated_output 
)

Definition at line 169 of file dest.c.

170{
172 Size len;
173
174 switch (dest)
175 {
176 case DestRemote:
178 case DestRemoteSimple:
179
183 break;
184
185 case DestNone:
186 case DestDebug:
187 case DestSPI:
188 case DestTuplestore:
189 case DestIntoRel:
190 case DestCopyOut:
191 case DestSQLFunction:
192 case DestTransientRel:
193 case DestTupleQueue:
195 break;
196 }
197}
size_t Size
Definition c.h:661
Size BuildQueryCompletionString(char *buff, const QueryCompletion *qc, bool nameonly)
Definition cmdtag.c:121
#define COMPLETION_TAG_BUFSIZE
Definition cmdtag.h:17
#define pq_putmessage(msgtype, s, len)
Definition libpq.h:52
const void size_t len
#define PqMsg_CommandComplete
Definition protocol.h:42

References BuildQueryCompletionString(), COMPLETION_TAG_BUFSIZE, DestCopyOut, DestDebug, DestExplainSerialize, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, fb(), len, pq_putmessage, and PqMsg_CommandComplete.

Referenced by exec_execute_message(), exec_simple_query(), StartLogicalReplication(), and WalSndDone().

◆ EndReplicationCommand()

void EndReplicationCommand ( const char commandTag)

Definition at line 206 of file dest.c.

207{
208 pq_putmessage(PqMsg_CommandComplete, commandTag, strlen(commandTag) + 1);
209}

References fb(), pq_putmessage, and PqMsg_CommandComplete.

Referenced by exec_replication_command(), and StartReplication().

◆ NullCommand()

void NullCommand ( CommandDest  dest)

Definition at line 219 of file dest.c.

220{
221 switch (dest)
222 {
223 case DestRemote:
225 case DestRemoteSimple:
226
227 /* Tell the FE that we saw an empty query string */
229 break;
230
231 case DestNone:
232 case DestDebug:
233 case DestSPI:
234 case DestTuplestore:
235 case DestIntoRel:
236 case DestCopyOut:
237 case DestSQLFunction:
238 case DestTransientRel:
239 case DestTupleQueue:
241 break;
242 }
243}
void pq_putemptymessage(char msgtype)
Definition pqformat.c:387
#define PqMsg_EmptyQueryResponse
Definition protocol.h:47

References DestCopyOut, DestDebug, DestExplainSerialize, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, pq_putemptymessage(), and PqMsg_EmptyQueryResponse.

Referenced by exec_execute_message(), and exec_simple_query().

◆ ReadyForQuery()

void ReadyForQuery ( CommandDest  dest)

Definition at line 257 of file dest.c.

258{
259 switch (dest)
260 {
261 case DestRemote:
263 case DestRemoteSimple:
264 {
266
270 }
271 /* Flush output at end of cycle in any case. */
272 pq_flush();
273 break;
274
275 case DestNone:
276 case DestDebug:
277 case DestSPI:
278 case DestTuplestore:
279 case DestIntoRel:
280 case DestCopyOut:
281 case DestSQLFunction:
282 case DestTransientRel:
283 case DestTupleQueue:
285 break;
286 }
287}
#define pq_flush()
Definition libpq.h:49
static char buf[DEFAULT_XLOG_SEG_SIZE]
void pq_endmessage(StringInfo buf)
Definition pqformat.c:296
void pq_beginmessage(StringInfo buf, char msgtype)
Definition pqformat.c:88
static void pq_sendbyte(StringInfo buf, uint8 byt)
Definition pqformat.h:160
#define PqMsg_ReadyForQuery
Definition protocol.h:55
char TransactionBlockStatusCode(void)
Definition xact.c:5026

References buf, DestCopyOut, DestDebug, DestExplainSerialize, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, pq_beginmessage(), pq_endmessage(), pq_flush, pq_sendbyte(), PqMsg_ReadyForQuery, and TransactionBlockStatusCode().

Referenced by PostgresMain().

Variable Documentation

◆ debugtupDR

const DestReceiver debugtupDR
static
Initial value:
= {
}
static void donothingCleanup(DestReceiver *self)
Definition dest.c:61
bool debugtup(TupleTableSlot *slot, DestReceiver *self)
Definition printtup.c:463
void debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo)
Definition printtup.c:445

Definition at line 75 of file dest.c.

Referenced by CreateDestReceiver().

◆ donothingDR

const DestReceiver donothingDR
static
Initial value:
= {
}
static void donothingStartup(DestReceiver *self, int operation, TupleDesc typeinfo)
Definition dest.c:56
static bool donothingReceive(TupleTableSlot *slot, DestReceiver *self)
Definition dest.c:50

Definition at line 70 of file dest.c.

Referenced by CreateDestReceiver().

◆ None_Receiver

◆ printsimpleDR

const DestReceiver printsimpleDR
static
Initial value:
= {
}
void printsimple_startup(DestReceiver *self, int operation, TupleDesc tupdesc)
Definition printsimple.c:32
bool printsimple(TupleTableSlot *slot, DestReceiver *self)
Definition printsimple.c:60

Definition at line 80 of file dest.c.

Referenced by CreateDestReceiver().

◆ spi_printtupDR

const DestReceiver spi_printtupDR
static
Initial value:
= {
}
bool spi_printtup(TupleTableSlot *slot, DestReceiver *self)
Definition spi.c:2170
void spi_dest_startup(DestReceiver *self, int operation, TupleDesc typeinfo)
Definition spi.c:2123

Definition at line 85 of file dest.c.

Referenced by CreateDestReceiver().