PostgreSQL Source Code  git master
dest.h File Reference
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
 

Macros

#define COMPLETION_TAG_BUFSIZE   64
 

Typedefs

typedef struct _DestReceiver DestReceiver
 

Enumerations

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

Functions

void BeginCommand (const char *commandTag, CommandDest dest)
 
DestReceiverCreateDestReceiver (CommandDest dest)
 
void EndCommand (const char *commandTag, CommandDest dest)
 
void NullCommand (CommandDest dest)
 
void ReadyForQuery (CommandDest dest)
 

Variables

PGDLLIMPORT DestReceiverNone_Receiver
 

Macro Definition Documentation

◆ COMPLETION_TAG_BUFSIZE

Typedef Documentation

◆ DestReceiver

Definition at line 113 of file dest.h.

Enumeration Type Documentation

◆ CommandDest

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

Definition at line 86 of file dest.h.

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

Function Documentation

◆ BeginCommand()

void BeginCommand ( const char *  commandTag,
CommandDest  dest 
)

Definition at line 103 of file dest.c.

Referenced by exec_execute_message(), and exec_simple_query().

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

◆ CreateDestReceiver()

DestReceiver* CreateDestReceiver ( CommandDest  dest)

Definition at line 113 of file dest.c.

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

Referenced by _SPI_execute_plan(), BeginCopy(), CreateReplicationSlot(), exec_execute_message(), exec_replication_command(), exec_simple_query(), execute_sql_string(), FillPortalStore(), IdentifySystem(), PersistHoldablePortal(), postquel_start(), SPI_cursor_fetch(), SPI_scroll_cursor_fetch(), and StartReplication().

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  }
156 
157  /* should never get here */
158  pg_unreachable();
159 }
#define pg_unreachable()
Definition: c.h:193
static const DestReceiver debugtupDR
Definition: dest.c:75
Definition: dest.h:93
static const DestReceiver printsimpleDR
Definition: dest.c:80
Definition: dest.h:88
DestReceiver * printtup_create_DR(CommandDest dest)
Definition: printtup.c:78
Definition: dest.h:89
DestReceiver * CreateIntoRelDestReceiver(IntoClause *intoClause)
Definition: createas.c:413
DestReceiver * CreateSQLFunctionDestReceiver(void)
Definition: functions.c:1955
#define unconstify(underlying_type, expr)
Definition: c.h:1163
#define InvalidOid
Definition: postgres_ext.h:36
static const DestReceiver spi_printtupDR
Definition: dest.c:85
DestReceiver * CreateTuplestoreDestReceiver(void)
DestReceiver * CreateTransientRelDestReceiver(Oid transientoid)
Definition: matview.c:430
DestReceiver * CreateCopyDestReceiver(void)
Definition: copy.c:5202
static const DestReceiver donothingDR
Definition: dest.c:70
DestReceiver * CreateTupleQueueDestReceiver(shm_mq_handle *handle)
Definition: tqueue.c:119

◆ EndCommand()

void EndCommand ( const char *  commandTag,
CommandDest  dest 
)

Definition at line 166 of file dest.c.

References DestCopyOut, DestDebug, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, and pq_putmessage.

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

167 {
168  switch (dest)
169  {
170  case DestRemote:
171  case DestRemoteExecute:
172  case DestRemoteSimple:
173 
174  /*
175  * We assume the commandTag is plain ASCII and therefore requires
176  * no encoding conversion.
177  */
178  pq_putmessage('C', commandTag, strlen(commandTag) + 1);
179  break;
180 
181  case DestNone:
182  case DestDebug:
183  case DestSPI:
184  case DestTuplestore:
185  case DestIntoRel:
186  case DestCopyOut:
187  case DestSQLFunction:
188  case DestTransientRel:
189  case DestTupleQueue:
190  break;
191  }
192 }
Definition: dest.h:93
Definition: dest.h:88
Definition: dest.h:89
#define pq_putmessage(msgtype, s, len)
Definition: libpq.h:42

◆ NullCommand()

void NullCommand ( CommandDest  dest)

Definition at line 207 of file dest.c.

References DestCopyOut, DestDebug, DestIntoRel, DestNone, DestRemote, DestRemoteExecute, DestRemoteSimple, DestSPI, DestSQLFunction, DestTransientRel, DestTupleQueue, DestTuplestore, FrontendProtocol, PG_PROTOCOL_MAJOR, pq_putemptymessage(), and pq_putmessage.

Referenced by exec_execute_message(), and exec_simple_query().

208 {
209  switch (dest)
210  {
211  case DestRemote:
212  case DestRemoteExecute:
213  case DestRemoteSimple:
214 
215  /*
216  * tell the fe that we saw an empty query string. In protocols
217  * before 3.0 this has a useless empty-string message body.
218  */
220  pq_putemptymessage('I');
221  else
222  pq_putmessage('I', "", 1);
223  break;
224 
225  case DestNone:
226  case DestDebug:
227  case DestSPI:
228  case DestTuplestore:
229  case DestIntoRel:
230  case DestCopyOut:
231  case DestSQLFunction:
232  case DestTransientRel:
233  case DestTupleQueue:
234  break;
235  }
236 }
Definition: dest.h:93
void pq_putemptymessage(char msgtype)
Definition: pqformat.c:390
#define PG_PROTOCOL_MAJOR(v)
Definition: pqcomm.h:104
Definition: dest.h:88
Definition: dest.h:89
#define pq_putmessage(msgtype, s, len)
Definition: libpq.h:42
ProtocolVersion FrontendProtocol
Definition: globals.c:28

◆ ReadyForQuery()

void ReadyForQuery ( CommandDest  dest)

Definition at line 250 of file dest.c.

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

Referenced by PostgresMain().

251 {
252  switch (dest)
253  {
254  case DestRemote:
255  case DestRemoteExecute:
256  case DestRemoteSimple:
258  {
260 
261  pq_beginmessage(&buf, 'Z');
263  pq_endmessage(&buf);
264  }
265  else
266  pq_putemptymessage('Z');
267  /* Flush output at end of cycle in any case. */
268  pq_flush();
269  break;
270 
271  case DestNone:
272  case DestDebug:
273  case DestSPI:
274  case DestTuplestore:
275  case DestIntoRel:
276  case DestCopyOut:
277  case DestSQLFunction:
278  case DestTransientRel:
279  case DestTupleQueue:
280  break;
281  }
282 }
#define pq_flush()
Definition: libpq.h:39
Definition: dest.h:93
void pq_putemptymessage(char msgtype)
Definition: pqformat.c:390
#define PG_PROTOCOL_MAJOR(v)
Definition: pqcomm.h:104
char TransactionBlockStatusCode(void)
Definition: xact.c:4641
void pq_beginmessage(StringInfo buf, char msgtype)
Definition: pqformat.c:87
static void pq_sendbyte(StringInfo buf, uint8 byt)
Definition: pqformat.h:161
Definition: dest.h:88
static char * buf
Definition: pg_test_fsync.c:68
Definition: dest.h:89
void pq_endmessage(StringInfo buf)
Definition: pqformat.c:298
ProtocolVersion FrontendProtocol
Definition: globals.c:28

Variable Documentation

◆ None_Receiver