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

Function FetchPreparedStatement

src/backend/commands/prepare.c:490–514  ·  view source on GitHub ↗

* Lookup an existing query in the hash table. If the query does not * actually exist, throw ereport(ERROR) or return NULL per second parameter. * * Note: this does not force the referenced plancache entry to be valid, * since not all callers care. */

Source from the content-addressed store, hash-verified

488 * since not all callers care.
489 */
490PreparedStatement *
491FetchPreparedStatement(const char *stmt_name, bool throwError)
492{
493 PreparedStatement *entry;
494
495 /*
496 * If the hash table hasn't been initialized, it can't be storing
497 * anything, therefore it couldn't possibly store our plan.
498 */
499 if (prepared_queries)
500 entry = (PreparedStatement *) hash_search(prepared_queries,
501 stmt_name,
502 HASH_FIND,
503 NULL);
504 else
505 entry = NULL;
506
507 if (!entry && throwError)
508 ereport(ERROR,
509 (errcode(ERRCODE_UNDEFINED_PSTATEMENT),
510 errmsg("prepared statement \"%s\" does not exist",
511 stmt_name)));
512
513 return entry;
514}
515
516/*
517 * Given a prepared statement, determine the result tupledesc it will

Callers 12

FetchStatementTargetListFunction · 0.85
exec_bind_messageFunction · 0.85
exec_execute_messageFunction · 0.85
errdetail_executeFunction · 0.85
UtilityReturnsTuplesFunction · 0.85
UtilityTupleDescriptorFunction · 0.85
GetCommandLogLevelFunction · 0.85
ExecuteQueryFunction · 0.85
DropPreparedStatementFunction · 0.85
ExplainExecuteQueryFunction · 0.85
get_query_stringFunction · 0.85

Calls 3

hash_searchFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected