* PortalRunMulti * Execute a portal's queries in the general case (multi queries * or non-SELECT-like queries) */
| 1403 | * or non-SELECT-like queries) |
| 1404 | */ |
| 1405 | static void |
| 1406 | PortalRunMulti(Portal portal, |
| 1407 | bool isTopLevel, bool setHoldSnapshot, |
| 1408 | DestReceiver *dest, DestReceiver *altdest, |
| 1409 | QueryCompletion *qc) |
| 1410 | { |
| 1411 | bool active_snapshot_set = false; |
| 1412 | ListCell *stmtlist_item; |
| 1413 | |
| 1414 | /* |
| 1415 | * If the destination is DestRemoteExecute, change to DestNone. The |
| 1416 | * reason is that the client won't be expecting any tuples, and indeed has |
| 1417 | * no way to know what they are, since there is no provision for Describe |
| 1418 | * to send a RowDescription message when this portal execution strategy is |
| 1419 | * in effect. This presently will only affect SELECT commands added to |
| 1420 | * non-SELECT queries by rewrite rules: such commands will be executed, |
| 1421 | * but the results will be discarded unless you use "simple Query" |
| 1422 | * protocol. |
| 1423 | */ |
| 1424 | if (dest->mydest == DestRemoteExecute) |
| 1425 | dest = None_Receiver; |
| 1426 | if (altdest->mydest == DestRemoteExecute) |
| 1427 | altdest = None_Receiver; |
| 1428 | |
| 1429 | /* |
| 1430 | * Loop to handle the individual queries generated from a single parsetree |
| 1431 | * by analysis and rewrite. |
| 1432 | */ |
| 1433 | foreach(stmtlist_item, portal->stmts) |
| 1434 | { |
| 1435 | PlannedStmt *pstmt = lfirst_node(PlannedStmt, stmtlist_item); |
| 1436 | |
| 1437 | /* |
| 1438 | * If we got a cancel signal in prior command, quit |
| 1439 | */ |
| 1440 | CHECK_FOR_INTERRUPTS(); |
| 1441 | |
| 1442 | if (pstmt->utilityStmt == NULL) |
| 1443 | { |
| 1444 | /* |
| 1445 | * process a plannable query. |
| 1446 | */ |
| 1447 | TRACE_POSTGRESQL_QUERY_EXECUTE_START(); |
| 1448 | |
| 1449 | if (log_executor_stats) |
| 1450 | ResetUsage(); |
| 1451 | |
| 1452 | /* |
| 1453 | * Must always have a snapshot for plannable queries. First time |
| 1454 | * through, take a new snapshot; for subsequent queries in the |
| 1455 | * same portal, just update the snapshot's copy of the command |
| 1456 | * counter. |
| 1457 | */ |
| 1458 | if (!active_snapshot_set) |
| 1459 | { |
| 1460 | Snapshot snapshot = GetTransactionSnapshot(); |
| 1461 | |
| 1462 | /* If told to, register the snapshot and save in portal */ |
no test coverage detected