mirror of
https://github.com/postgres/postgres.git
synced 2025-07-17 06:41:09 +03:00
Make better use of ParseState in ProcessUtility
Pass ParseState into the functions called from standard_ProcessUtility() instead passing the query string and query environment separately. No functionality change, but it makes the notation consistent. We had already started moving things into that direction piece by piece, and this completes it. Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/6e7aa4a1-be6a-1a75-b1f9-83a678e5184a@2ndquadrant.com
This commit is contained in:
@ -39,14 +39,15 @@
|
||||
* Execute SQL DECLARE CURSOR command.
|
||||
*/
|
||||
void
|
||||
PerformCursorOpen(DeclareCursorStmt *cstmt, ParamListInfo params,
|
||||
const char *queryString, bool isTopLevel)
|
||||
PerformCursorOpen(ParseState *pstate, DeclareCursorStmt *cstmt, ParamListInfo params,
|
||||
bool isTopLevel)
|
||||
{
|
||||
Query *query = castNode(Query, cstmt->query);
|
||||
List *rewritten;
|
||||
PlannedStmt *plan;
|
||||
Portal portal;
|
||||
MemoryContext oldContext;
|
||||
char *queryString;
|
||||
|
||||
/*
|
||||
* Disallow empty-string cursor name (conflicts with protocol-level
|
||||
@ -92,7 +93,7 @@ PerformCursorOpen(DeclareCursorStmt *cstmt, ParamListInfo params,
|
||||
plan = pg_plan_query(query, cstmt->options, params);
|
||||
|
||||
/*
|
||||
* Create a portal and copy the plan and queryString into its memory.
|
||||
* Create a portal and copy the plan and query string into its memory.
|
||||
*/
|
||||
portal = CreatePortal(cstmt->portalname, false, false);
|
||||
|
||||
@ -100,7 +101,7 @@ PerformCursorOpen(DeclareCursorStmt *cstmt, ParamListInfo params,
|
||||
|
||||
plan = copyObject(plan);
|
||||
|
||||
queryString = pstrdup(queryString);
|
||||
queryString = pstrdup(pstate->p_sourcetext);
|
||||
|
||||
PortalDefineQuery(portal,
|
||||
NULL,
|
||||
|
Reference in New Issue
Block a user