MCPcopy Create free account
hub / github.com/apache/cloudberry / EndCommand

Function EndCommand

src/backend/tcop/dest.c:170–218  ·  view source on GitHub ↗

---------------- * EndCommand - clean up the destination at end of command * ---------------- */

Source from the content-addressed store, hash-verified

168 * ----------------
169 */
170void
171EndCommand(const QueryCompletion *qc, CommandDest dest, bool force_undecorated_output)
172{
173 char completionTag[COMPLETION_TAG_BUFSIZE];
174 CommandTag tag;
175 const char *tagname;
176
177 switch (dest)
178 {
179 case DestRemote:
180 case DestRemoteExecute:
181 case DestRemoteSimple:
182
183 /*
184 * We assume the tagname is plain ASCII and therefore requires no
185 * encoding conversion.
186 *
187 * We no longer display LastOid, but to preserve the wire
188 * protocol, we write InvalidOid where the LastOid used to be
189 * written.
190 *
191 * All cases where LastOid was written also write nprocessed
192 * count, so just Assert that rather than having an extra test.
193 */
194 tag = qc->commandTag;
195 tagname = GetCommandTagName(tag);
196
197 if (command_tag_display_rowcount(tag) && !force_undecorated_output)
198 snprintf(completionTag, COMPLETION_TAG_BUFSIZE,
199 tag == CMDTAG_INSERT ?
200 "%s 0 " UINT64_FORMAT : "%s " UINT64_FORMAT,
201 tagname, qc->nprocessed);
202 else
203 snprintf(completionTag, COMPLETION_TAG_BUFSIZE, "%s", tagname);
204 pq_putmessage('C', completionTag, strlen(completionTag) + 1);
205
206 case DestNone:
207 case DestDebug:
208 case DestSPI:
209 case DestTuplestore:
210 case DestIntoRel:
211 case DestCopyOut:
212 case DestSQLFunction:
213 case DestTransientRel:
214 case DestTupleQueue:
215 case DestPersistentstore:
216 break;
217 }
218}
219
220/* ----------------
221 * EndReplicationCommand - stripped down version of EndCommand

Callers 10

exec_mpp_queryFunction · 0.85
exec_simple_queryFunction · 0.85
exec_execute_messageFunction · 0.85
PostgresMainFunction · 0.85
HandleFaultMessageFunction · 0.85
SendFtsResponseFunction · 0.85
ExecuteSqlStringFunction · 0.85
StartLogicalReplicationFunction · 0.85
WalSndDoneFunction · 0.85

Calls 2

GetCommandTagNameFunction · 0.85

Tested by

no test coverage detected