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

Function if

src/interfaces/libpq/fe-protocol3.c:189–235  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187 }
188#endif
189 else if (conn->asyncStatus != PGASYNC_BUSY)
190 {
191 /* If not IDLE state, just wait ... */
192 if (conn->asyncStatus != PGASYNC_IDLE)
193 return;
194
195 /*
196 * We're also notionally not-IDLE when in pipeline mode the state
197 * says "idle" (so we have completed receiving the results of one
198 * query from the server and dispatched them to the application)
199 * but another query is queued; yield back control to caller so
200 * that they can initiate processing of the next query in the
201 * queue.
202 */
203 if (conn->pipelineStatus != PQ_PIPELINE_OFF &&
204 conn->cmd_queue_head != NULL)
205 return;
206
207 /*
208 * Unexpected message in IDLE state; need to recover somehow.
209 * ERROR messages are handled using the notice processor;
210 * ParameterStatus is handled normally; anything else is just
211 * dropped on the floor after displaying a suitable warning
212 * notice. (An ERROR is very possibly the backend telling us why
213 * it is about to close the connection, so we don't want to just
214 * discard it...)
215 */
216 if (id == 'E')
217 {
218 if (pqGetErrorNotice3(conn, false /* treat as notice */ ))
219 return;
220 }
221 else if (id == 'S')
222 {
223 if (getParameterStatus(conn))
224 return;
225 }
226 else
227 {
228 /* Any other case is unexpected and we summarily skip it */
229 pqInternalNotice(&conn->noticeHooks,
230 "message type 0x%02x arrived from server while idle",
231 id);
232 /* Discard the unexpected message */
233 conn->inCursor += msgLength;
234 }
235 }
236 else
237 {
238 /*

Callers

nothing calls this directly

Calls 3

pqGetErrorNotice3Function · 0.85
getParameterStatusFunction · 0.85
pqInternalNoticeFunction · 0.85

Tested by

no test coverage detected