PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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

DestReceiverNone_Receiver
 

Macro Definition Documentation

Typedef Documentation

Definition at line 113 of file dest.h.

Enumeration Type Documentation

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

void BeginCommand ( const char *  commandTag,
CommandDest  dest 
)

Definition at line 99 of file dest.c.

Referenced by exec_execute_message(), and exec_simple_query().

100 {
101  /* Nothing to do at present */
102 }
DestReceiver* CreateDestReceiver ( CommandDest  dest)

Definition at line 109 of file dest.c.

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

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().

110 {
111  switch (dest)
112  {
113  case DestRemote:
114  case DestRemoteExecute:
115  return printtup_create_DR(dest);
116 
117  case DestRemoteSimple:
118  return &printsimpleDR;
119 
120  case DestNone:
121  return &donothingDR;
122 
123  case DestDebug:
124  return &debugtupDR;
125 
126  case DestSPI:
127  return &spi_printtupDR;
128 
129  case DestTuplestore:
131 
132  case DestIntoRel:
134 
135  case DestCopyOut:
136  return CreateCopyDestReceiver();
137 
138  case DestSQLFunction:
140 
141  case DestTransientRel:
143 
144  case DestTupleQueue:
146  }
147 
148  /* should never get here */
149  return &donothingDR;
150 }
Definition: dest.h:93
static DestReceiver debugtupDR
Definition: dest.c:75
Definition: dest.h:88
DestReceiver * printtup_create_DR(CommandDest dest)
Definition: printtup.c:73
Definition: dest.h:89
static DestReceiver donothingDR
Definition: dest.c:70
DestReceiver * CreateIntoRelDestReceiver(IntoClause *intoClause)
Definition: createas.c:423
static DestReceiver spi_printtupDR
Definition: dest.c:85
DestReceiver * CreateSQLFunctionDestReceiver(void)
Definition: functions.c:1883
#define InvalidOid
Definition: postgres_ext.h:36
#define NULL
Definition: c.h:229
DestReceiver * CreateTuplestoreDestReceiver(void)
DestReceiver * CreateTransientRelDestReceiver(Oid transientoid)
Definition: matview.c:443
DestReceiver * CreateCopyDestReceiver(void)
Definition: copy.c:4742
DestReceiver * CreateTupleQueueDestReceiver(shm_mq_handle *handle)
Definition: tqueue.c:606
static DestReceiver printsimpleDR
Definition: dest.c:80
void EndCommand ( const char *  commandTag,
CommandDest  dest 
)

Definition at line 157 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().

158 {
159  switch (dest)
160  {
161  case DestRemote:
162  case DestRemoteExecute:
163  case DestRemoteSimple:
164 
165  /*
166  * We assume the commandTag is plain ASCII and therefore requires
167  * no encoding conversion.
168  */
169  pq_putmessage('C', commandTag, strlen(commandTag) + 1);
170  break;
171 
172  case DestNone:
173  case DestDebug:
174  case DestSPI:
175  case DestTuplestore:
176  case DestIntoRel:
177  case DestCopyOut:
178  case DestSQLFunction:
179  case DestTransientRel:
180  case DestTupleQueue:
181  break;
182  }
183 }
Definition: dest.h:93
Definition: dest.h:88
Definition: dest.h:89
#define pq_putmessage(msgtype, s, len)
Definition: libpq.h:42
void NullCommand ( CommandDest  dest)

Definition at line 198 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().

199 {
200  switch (dest)
201  {
202  case DestRemote:
203  case DestRemoteExecute:
204  case DestRemoteSimple:
205 
206  /*
207  * tell the fe that we saw an empty query string. In protocols
208  * before 3.0 this has a useless empty-string message body.
209  */
211  pq_putemptymessage('I');
212  else
213  pq_putmessage('I', "", 1);
214  break;
215 
216  case DestNone:
217  case DestDebug:
218  case DestSPI:
219  case DestTuplestore:
220  case DestIntoRel:
221  case DestCopyOut:
222  case DestSQLFunction:
223  case DestTransientRel:
224  case DestTupleQueue:
225  break;
226  }
227 }
Definition: dest.h:93
void pq_putemptymessage(char msgtype)
Definition: pqformat.c:421
#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:27
void ReadyForQuery ( CommandDest  dest)

Definition at line 241 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().

242 {
243  switch (dest)
244  {
245  case DestRemote:
246  case DestRemoteExecute:
247  case DestRemoteSimple:
249  {
251 
252  pq_beginmessage(&buf, 'Z');
254  pq_endmessage(&buf);
255  }
256  else
257  pq_putemptymessage('Z');
258  /* Flush output at end of cycle in any case. */
259  pq_flush();
260  break;
261 
262  case DestNone:
263  case DestDebug:
264  case DestSPI:
265  case DestTuplestore:
266  case DestIntoRel:
267  case DestCopyOut:
268  case DestSQLFunction:
269  case DestTransientRel:
270  case DestTupleQueue:
271  break;
272  }
273 }
#define pq_flush()
Definition: libpq.h:39
void pq_sendbyte(StringInfo buf, int byt)
Definition: pqformat.c:105
Definition: dest.h:93
void pq_putemptymessage(char msgtype)
Definition: pqformat.c:421
#define PG_PROTOCOL_MAJOR(v)
Definition: pqcomm.h:104
char TransactionBlockStatusCode(void)
Definition: xact.c:4338
void pq_beginmessage(StringInfo buf, char msgtype)
Definition: pqformat.c:88
Definition: dest.h:88
static char * buf
Definition: pg_test_fsync.c:66
Definition: dest.h:89
void pq_endmessage(StringInfo buf)
Definition: pqformat.c:344
ProtocolVersion FrontendProtocol
Definition: globals.c:27

Variable Documentation