PostgreSQL Source Code  git master
dest.h File Reference
#include "executor/tuptable.h"
#include "tcop/cmdtag.h"
Include dependency graph for dest.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _DestReceiver
 

Typedefs

typedef struct _DestReceiver DestReceiver
 

Enumerations

enum  CommandDest {
  DestNone , DestDebug , DestRemote , DestRemoteExecute ,
  DestRemoteSimple , DestSPI , DestTuplestore , DestIntoRel ,
  DestCopyOut , DestSQLFunction , DestTransientRel , DestTupleQueue ,
  DestExplainSerialize
}
 

Functions

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

PGDLLIMPORT DestReceiverNone_Receiver
 

Typedef Documentation

◆ DestReceiver

typedef struct _DestReceiver DestReceiver

Definition at line 1 of file dest.h.

Enumeration Type Documentation

◆ CommandDest

Enumerator
DestNone 
DestDebug 
DestRemote 
DestRemoteExecute 
DestRemoteSimple 
DestSPI 
DestTuplestore 
DestIntoRel 
DestCopyOut 
DestSQLFunction 
DestTransientRel 
DestTupleQueue 
DestExplainSerialize 

Definition at line 85 of file dest.h.

86 {
87  DestNone, /* results are discarded */
88  DestDebug, /* results go to debugging output */
89  DestRemote, /* results sent to frontend process */
90  DestRemoteExecute, /* sent to frontend, in Execute command */
91  DestRemoteSimple, /* sent to frontend, w/no catalog access */
92  DestSPI, /* results sent to SPI manager */
93  DestTuplestore, /* results sent to Tuplestore */
94  DestIntoRel, /* results sent to relation (SELECT INTO) */
95  DestCopyOut, /* results sent to COPY TO code */
96  DestSQLFunction, /* results sent to SQL-language func mgr */
97  DestTransientRel, /* results sent to transient relation */
98  DestTupleQueue, /* results sent to tuple queue */
99  DestExplainSerialize, /* results are serialized and discarded */
100 } CommandDest;
CommandDest
Definition: dest.h:86
@ 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

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:
123  case DestRemoteExecute:
124  return printtup_create_DR(dest);
125 
126  case DestRemoteSimple:
128 
129  case DestNone:
130  return unconstify(DestReceiver *, &donothingDR);
131 
132  case DestDebug:
133  return unconstify(DestReceiver *, &debugtupDR);
134 
135  case DestSPI:
137 
138  case DestTuplestore:
140 
141  case DestIntoRel:
142  return CreateIntoRelDestReceiver(NULL);
143 
144  case DestCopyOut:
145  return CreateCopyDestReceiver();
146 
147  case DestSQLFunction:
149 
150  case DestTransientRel:
152 
153  case DestTupleQueue:
154  return CreateTupleQueueDestReceiver(NULL);
155 
158  }
159 
160  /* should never get here */
161  pg_unreachable();
162 }
#define unconstify(underlying_type, expr)
Definition: c.h:1245
#define pg_unreachable()
Definition: c.h:296
DestReceiver * CreateCopyDestReceiver(void)
Definition: copyto.c:1267
DestReceiver * CreateIntoRelDestReceiver(IntoClause *intoClause)
Definition: createas.c:435
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
DestReceiver * CreateExplainSerializeDestReceiver(ExplainState *es)
Definition: explain.c:5555
DestReceiver * CreateSQLFunctionDestReceiver(void)
Definition: functions.c:2062
DestReceiver * CreateTransientRelDestReceiver(Oid transientoid)
Definition: matview.c:432
#define InvalidOid
Definition: postgres_ext.h:36
DestReceiver * printtup_create_DR(CommandDest dest)
Definition: printtup.c:70
DestReceiver * CreateTupleQueueDestReceiver(shm_mq_handle *handle)
Definition: tqueue.c:119
DestReceiver * CreateTuplestoreDestReceiver(void)

References CreateCopyDestReceiver(), CreateExplainSerializeDestReceiver(), CreateIntoRelDestReceiver(), CreateSQLFunctionDestReceiver(), CreateTransientRelDestReceiver(), CreateTupleQueueDestReceiver(), CreateTuplestoreDestReceiver(), debugtupDR, generate_unaccent_rules::dest, DestCopyOut, DestDebug, DestExplainSerialize, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, donothingDR, 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().

◆ EndCommand()

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

Definition at line 169 of file dest.c.

170 {
171  char completionTag[COMPLETION_TAG_BUFSIZE];
172  Size len;
173 
174  switch (dest)
175  {
176  case DestRemote:
177  case DestRemoteExecute:
178  case DestRemoteSimple:
179 
180  len = BuildQueryCompletionString(completionTag, qc,
181  force_undecorated_output);
182  pq_putmessage(PqMsg_CommandComplete, completionTag, len + 1);
183 
184  case DestNone:
185  case DestDebug:
186  case DestSPI:
187  case DestTuplestore:
188  case DestIntoRel:
189  case DestCopyOut:
190  case DestSQLFunction:
191  case DestTransientRel:
192  case DestTupleQueue:
194  break;
195  }
196 }
size_t Size
Definition: c.h:605
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:49
const void size_t len
#define PqMsg_CommandComplete
Definition: protocol.h:42

References BuildQueryCompletionString(), COMPLETION_TAG_BUFSIZE, generate_unaccent_rules::dest, DestCopyOut, DestDebug, DestExplainSerialize, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, 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 205 of file dest.c.

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

References pq_putmessage, and PqMsg_CommandComplete.

Referenced by exec_replication_command(), and StartReplication().

◆ NullCommand()

void NullCommand ( CommandDest  dest)

Definition at line 218 of file dest.c.

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

References generate_unaccent_rules::dest, 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 256 of file dest.c.

257 {
258  switch (dest)
259  {
260  case DestRemote:
261  case DestRemoteExecute:
262  case DestRemoteSimple:
263  {
265 
268  pq_endmessage(&buf);
269  }
270  /* Flush output at end of cycle in any case. */
271  pq_flush();
272  break;
273 
274  case DestNone:
275  case DestDebug:
276  case DestSPI:
277  case DestTuplestore:
278  case DestIntoRel:
279  case DestCopyOut:
280  case DestSQLFunction:
281  case DestTransientRel:
282  case DestTupleQueue:
284  break;
285  }
286 }
#define pq_flush()
Definition: libpq.h:46
static char * buf
Definition: pg_test_fsync.c:73
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:4947

References buf, generate_unaccent_rules::dest, 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

◆ None_Receiver